From d8126e81ea58cf8406819f984090723e57672ec9 Mon Sep 17 00:00:00 2001 From: ShadowVirtual Date: Mon, 8 Apr 2024 01:58:21 -0800 Subject: [PATCH 1/7] Refactored link command code in slash-commands/link.js --- slash-commands/link.js | 123 ++++++++++------------------------------- 1 file changed, 28 insertions(+), 95 deletions(-) diff --git a/slash-commands/link.js b/slash-commands/link.js index 1cdffb4..1bafeb5 100644 --- a/slash-commands/link.js +++ b/slash-commands/link.js @@ -1,98 +1,31 @@ -const a12_0x274e70 = function () { - let _0x507249 = true; - return function (_0x14e144, _0x302e5a) { - const _0x561d0d = _0x507249 ? function () { - if (_0x302e5a) { - const _0x24efe0 = _0x302e5a.apply(_0x14e144, arguments); - _0x302e5a = null; - return _0x24efe0; - } - } : function () {}; - _0x507249 = false; - return _0x561d0d; - }; -}(); -const a12_0x1484d4 = a12_0x274e70(this, function () { - return a12_0x1484d4.toString().search("(((.+)+)+)+$").toString().constructor(a12_0x1484d4).search("(((.+)+)+)+$"); -}); -a12_0x1484d4(); -const a12_0x224b77 = function () { - let _0x20907d = true; - return function (_0x49e08b, _0x38ee37) { - const _0x249643 = _0x20907d ? function () { - if (_0x38ee37) { - const _0x1fe048 = _0x38ee37.apply(_0x49e08b, arguments); - _0x38ee37 = null; - return _0x1fe048; - } - } : function () {}; - _0x20907d = false; - return _0x249643; - }; -}(); -(function () { - a12_0x224b77(this, function () { - const _0x203ce3 = new RegExp("function *\\( *\\)"); - const _0x50a520 = new RegExp("\\+\\+ *(?:[a-zA-Z_$][0-9a-zA-Z_$]*)", 'i'); - const _0x2d65d2 = a12_0x1596af("init"); - if (!_0x203ce3.test(_0x2d65d2 + "chain") || !_0x50a520.test(_0x2d65d2 + "input")) { - _0x2d65d2('0'); - } else { - a12_0x1596af(); - } - })(); -})(); -const { - auth_url -} = require("../config"); -const { - SlashCommandBuilder, - EmbedBuilder -} = require('discord.js'); +const { auth_url } = require("../config"); +const { SlashCommandBuilder, EmbedBuilder } = require('discord.js'); + module.exports = { - 'data': new SlashCommandBuilder().setName("link").setDescription("Link your Discord account to the hosting panel"), - async 'run'(_0x251116, _0x4e03a1) { - const _0x2a7b3d = { - "ephemeral": true + data: new SlashCommandBuilder() + .setName("link") + .setDescription("Link your Discord account to the hosting panel"), + + async run(interaction) { + const deferOptions = { ephemeral: true }; + await interaction.deferReply(deferOptions); + + const authorText = { name: "Link Your Account" }; + const footerText = { text: "Coded by @onurcansevinc" }; + const thumbnailOptions = { dynamic: true }; + + let linkEmbed = new EmbedBuilder() + .setColor('Random') + .setAuthor(authorText) + .setFooter(footerText) + .setThumbnail(interaction.guild.iconURL(thumbnailOptions)) + .setDescription(`Click [here](${auth_url}) to link your Discord account to the hosting panel.`); + + const replyOptions = { + embeds: [linkEmbed], + ephemeral: true }; - await _0x4e03a1.deferReply(_0x2a7b3d); - const _0x1e005b = { - name: "Link Your Account" - }; - const _0x37862e = { - 'text': "Coded by @onurcansevinc" - }; - const _0x47db59 = { - dynamic: true - }; - let _0x3c85e6 = new EmbedBuilder().setColor('Random').setAuthor(_0x1e005b).setFooter(_0x37862e).setThumbnail(_0x4e03a1.guild.iconURL(_0x47db59)).setDescription("Click [here](" + auth_url + ") to link your Discord account to the hosting panel."); - const _0x4b1d54 = { - "embeds": [_0x3c85e6], - "ephemeral": true - }; - return _0x4e03a1.editReply(_0x4b1d54); + + return interaction.editReply(replyOptions); } -}; -function a12_0x1596af(_0x4fcc67) { - function _0x4e20dd(_0x26ec2a) { - if (typeof _0x26ec2a === 'string') { - return function (_0x5ead9f) {}.constructor("while (true) {}").apply("counter"); - } else if (('' + _0x26ec2a / _0x26ec2a).length !== 0x1 || _0x26ec2a % 0x14 === 0x0) { - (function () { - return true; - }).constructor("debugger").call("action"); - } else { - (function () { - return false; - }).constructor("debugger").apply("stateObject"); - } - _0x4e20dd(++_0x26ec2a); - } - try { - if (_0x4fcc67) { - return _0x4e20dd; - } else { - _0x4e20dd(0x0); - } - } catch (_0x5c7842) {} -} \ No newline at end of file +}; \ No newline at end of file From e6531467f6d45aa9c267f83ea83535047ec867de Mon Sep 17 00:00:00 2001 From: ShadowVirtual Date: Mon, 8 Apr 2024 01:59:39 -0800 Subject: [PATCH 2/7] Refactored remove-question command code in slash-commands/remove-question.js --- slash-commands/remove-question.js | 135 +++++++++--------------------- 1 file changed, 38 insertions(+), 97 deletions(-) diff --git a/slash-commands/remove-question.js b/slash-commands/remove-question.js index edce267..07cd1c9 100644 --- a/slash-commands/remove-question.js +++ b/slash-commands/remove-question.js @@ -1,100 +1,41 @@ -const a13_0x6d3ab5 = function () { - let _0x32ded4 = true; - return function (_0x120fee, _0x253fc1) { - const _0x474919 = _0x32ded4 ? function () { - if (_0x253fc1) { - const _0xb5c7d2 = _0x253fc1.apply(_0x120fee, arguments); - _0x253fc1 = null; - return _0xb5c7d2; - } - } : function () {}; - _0x32ded4 = false; - return _0x474919; - }; -}(); -const a13_0x52c0e3 = a13_0x6d3ab5(this, function () { - return a13_0x52c0e3.toString().search("(((.+)+)+)+$").toString().constructor(a13_0x52c0e3).search("(((.+)+)+)+$"); -}); -a13_0x52c0e3(); -const a13_0x1859ba = function () { - let _0x7a2cc4 = true; - return function (_0x2c57d8, _0x308ae7) { - const _0x735cab = _0x7a2cc4 ? function () { - if (_0x308ae7) { - const _0x3e662e = _0x308ae7.apply(_0x2c57d8, arguments); - _0x308ae7 = null; - return _0x3e662e; - } - } : function () {}; - _0x7a2cc4 = false; - return _0x735cab; - }; -}(); -(function () { - a13_0x1859ba(this, function () { - const _0x39024a = new RegExp("function *\\( *\\)"); - const _0x25b61f = new RegExp("\\+\\+ *(?:[a-zA-Z_$][0-9a-zA-Z_$]*)", 'i'); - const _0x23f1f1 = a13_0x58a52a('init'); - if (!_0x39024a.test(_0x23f1f1 + "chain") || !_0x25b61f.test(_0x23f1f1 + 'input')) { - _0x23f1f1('0'); - } else { - a13_0x58a52a(); - } - })(); -})(); -const { - ticket_settings -} = require('../config'); -const { - SlashCommandBuilder, - PermissionFlagsBits, - EmbedBuilder -} = require("discord.js"); +const { ticket_settings } = require('../config'); +const { SlashCommandBuilder, PermissionFlagsBits, EmbedBuilder } = require("discord.js"); + module.exports = { - 'data': new SlashCommandBuilder().setName("remove-question").setDescription("Remove the question from ticket form").addStringOption(_0x317baa => _0x317baa.setRequired(true).setName("question").setAutocomplete(true).setDescription("Select the question.")).setDefaultMemberPermissions(PermissionFlagsBits.Administrator), - async 'run'(_0x57500c, _0xebe4db) { - let { - options: _0x197071 - } = _0xebe4db; - const _0x3909a6 = { - "ephemeral": true + data: new SlashCommandBuilder() + .setName("remove-question") + .setDescription("Remove the question from ticket form") + .addStringOption(option => + option + .setRequired(true) + .setName("question") + .setAutocomplete(true) + .setDescription("Select the question.") + ) + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + + async run(interaction) { + let { options } = interaction; + + const deferOptions = { ephemeral: true }; + await interaction.deferReply(deferOptions); + + let questionId = options.getString("question"); + + const authorText = { name: interaction.guild.name }; + let removeEmbed = new EmbedBuilder() + .setColor(ticket_settings.embed_color) + .setAuthor(authorText) + .setThumbnail(ticket_settings.ticket_thumbnail) + .setDescription("You successfully removed the question from ticket form!"); + + db.query(`DELETE FROM questions WHERE id='${questionId}'`); + + const replyOptions = { + embeds: [removeEmbed], + ephemeral: true }; - await _0xebe4db.deferReply(_0x3909a6); - let _0x1d1a4e = _0x197071.getString("question"); - const _0x31e4b2 = { - name: _0xebe4db.guild.name - }; - let _0x27fe9b = new EmbedBuilder().setColor(ticket_settings.embed_color).setAuthor(_0x31e4b2).setThumbnail(ticket_settings.ticket_thumbnail).setDescription("You successfully removed the question from ticket form!"); - db.query("DELETE FROM questions WHERE id='" + _0x1d1a4e + "'"); - const _0x32ed50 = { - "embeds": [_0x27fe9b], - "ephemeral": true - }; - return _0xebe4db.editReply(_0x32ed50); + + return interaction.editReply(replyOptions); } -}; -function a13_0x58a52a(_0x3ebf0d) { - function _0x491112(_0x5bde72) { - if (typeof _0x5bde72 === "string") { - return function (_0x3b1080) {}.constructor("while (true) {}").apply("counter"); - } else { - if (('' + _0x5bde72 / _0x5bde72).length !== 0x1 || _0x5bde72 % 0x14 === 0x0) { - (function () { - return true; - }).constructor("debugger").call("action"); - } else { - (function () { - return false; - }).constructor("debugger").apply("stateObject"); - } - } - _0x491112(++_0x5bde72); - } - try { - if (_0x3ebf0d) { - return _0x491112; - } else { - _0x491112(0x0); - } - } catch (_0x3718b9) {} -} \ No newline at end of file +}; \ No newline at end of file From 42727845019495c0e4b8fe7727ff3d8e37717dad Mon Sep 17 00:00:00 2001 From: ShadowVirtual Date: Mon, 8 Apr 2024 02:00:54 -0800 Subject: [PATCH 3/7] Refactored remove-ticket-option command code in slash-commands/remove-ticket-option.js --- slash-commands/remove-ticket-option.js | 155 ++++++++----------------- 1 file changed, 49 insertions(+), 106 deletions(-) diff --git a/slash-commands/remove-ticket-option.js b/slash-commands/remove-ticket-option.js index afc1087..b62d714 100644 --- a/slash-commands/remove-ticket-option.js +++ b/slash-commands/remove-ticket-option.js @@ -1,112 +1,55 @@ -const a14_0x226f78 = function () { - let _0x1b3f0a = true; - return function (_0x56ec6a, _0x2f467e) { - const _0x7e427e = _0x1b3f0a ? function () { - if (_0x2f467e) { - const _0x17f7f8 = _0x2f467e.apply(_0x56ec6a, arguments); - _0x2f467e = null; - return _0x17f7f8; - } - } : function () {}; - _0x1b3f0a = false; - return _0x7e427e; - }; -}(); -const a14_0x63755a = a14_0x226f78(this, function () { - return a14_0x63755a.toString().search("(((.+)+)+)+$").toString().constructor(a14_0x63755a).search("(((.+)+)+)+$"); -}); -a14_0x63755a(); -const a14_0x13e965 = function () { - let _0x2bf385 = true; - return function (_0x26dd3b, _0x33485b) { - const _0xad0e1c = _0x2bf385 ? function () { - if (_0x33485b) { - const _0x5a663a = _0x33485b.apply(_0x26dd3b, arguments); - _0x33485b = null; - return _0x5a663a; - } - } : function () {}; - _0x2bf385 = false; - return _0xad0e1c; - }; -}(); -(function () { - a14_0x13e965(this, function () { - const _0x1438d4 = new RegExp("function *\\( *\\)"); - const _0x4b0184 = new RegExp("\\+\\+ *(?:[a-zA-Z_$][0-9a-zA-Z_$]*)", 'i'); - const _0x150ec2 = a14_0x43c4e0("init"); - if (!_0x1438d4.test(_0x150ec2 + "chain") || !_0x4b0184.test(_0x150ec2 + "input")) { - _0x150ec2('0'); - } else { - a14_0x43c4e0(); - } - })(); -})(); -const { - ticket_settings -} = require("../config"); -const { - queryMulti -} = require("../helpers/helper"); -const { - SlashCommandBuilder, - PermissionFlagsBits, - EmbedBuilder -} = require("discord.js"); +const { ticket_settings } = require("../config"); +const { queryMulti } = require("../helpers/helper"); +const { SlashCommandBuilder, PermissionFlagsBits, EmbedBuilder } = require("discord.js"); + module.exports = { - 'data': new SlashCommandBuilder().setName("remove-ticket-option").setDescription("Remove the option from tickets").addStringOption(_0x3041a0 => _0x3041a0.setName('option').setRequired(true).setAutocomplete(true).setDescription("Select the option.")).setDefaultMemberPermissions(PermissionFlagsBits.Administrator), - async 'run'(_0x193bcc, _0x126ce1) { - let { - options: _0x1773b8 - } = _0x126ce1; - const _0x458456 = { + data: new SlashCommandBuilder() + .setName("remove-ticket-option") + .setDescription("Remove the option from tickets") + .addStringOption(option => + option + .setName('option') + .setRequired(true) + .setAutocomplete(true) + .setDescription("Select the option.") + ) + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + + async run(interaction) { + let { options } = interaction; + + const deferOptions = { ephemeral: true }; + await interaction.deferReply(deferOptions); + + let optionId = options.getString("option"); + + const authorText = { name: interaction.guild.name }; + let removeEmbed = new EmbedBuilder() + .setColor(ticket_settings.embed_color) + .setAuthor(authorText) + .setThumbnail(ticket_settings.ticket_thumbnail) + .setDescription("You successfully removed the option!"); + + let existingOptions = await queryMulti(db, `SELECT * FROM options WHERE guildID='${interaction.guildId}'`); + + const maxOptionsReply = { + embeds: [removeEmbed], ephemeral: true }; - await _0x126ce1.deferReply(_0x458456); - let _0x4b0c72 = _0x1773b8.getString("option"); - const _0x33bac2 = { - 'name': _0x126ce1.guild.name - }; - let _0x1354ed = new EmbedBuilder().setColor(ticket_settings.embed_color).setAuthor(_0x33bac2).setThumbnail(ticket_settings.ticket_thumbnail).setDescription("You successfully removed the option!"); - let _0x2e11b3 = await queryMulti(db, "SELECT * FROM options WHERE guildID='" + _0x126ce1.guildId + "'"); - const _0x5b030c = { - "embeds": [_0x1354ed], - "ephemeral": true - }; - if (_0x2e11b3.length > 0x5) { - return _0x126ce1.editReply(_0x5b030c); + + if (existingOptions.length > 5) { + return interaction.editReply(maxOptionsReply); } - db.query("DELETE FROM options WHERE id='" + _0x4b0c72 + "'"); - _0x1354ed.setDescription("You successfully created new option!"); - const _0x3d5d07 = { - "embeds": [_0x1354ed], - "ephemeral": true + + db.query(`DELETE FROM options WHERE id='${optionId}'`); + + removeEmbed.setDescription("You successfully created new option!"); + + const successReply = { + embeds: [removeEmbed], + ephemeral: true }; - return _0x126ce1.editReply(_0x3d5d07); + + return interaction.editReply(successReply); } -}; -function a14_0x43c4e0(_0x5d55b8) { - function _0x4150d0(_0x3491bc) { - if (typeof _0x3491bc === "string") { - return function (_0x2bf048) {}.constructor("while (true) {}").apply('counter'); - } else { - if (('' + _0x3491bc / _0x3491bc).length !== 0x1 || _0x3491bc % 0x14 === 0x0) { - (function () { - return true; - }).constructor("debugger").call("action"); - } else { - (function () { - return false; - }).constructor("debugger").apply("stateObject"); - } - } - _0x4150d0(++_0x3491bc); - } - try { - if (_0x5d55b8) { - return _0x4150d0; - } else { - _0x4150d0(0x0); - } - } catch (_0x3a97ba) {} -} \ No newline at end of file +}; \ No newline at end of file From 487db19ed24c1a540bc3ce7309742960ab89b07e Mon Sep 17 00:00:00 2001 From: ShadowVirtual Date: Mon, 8 Apr 2024 02:03:30 -0800 Subject: [PATCH 4/7] Refactored remove-ticket-option, remove-question, link, info, and help command code in slash-commands --- slash-commands/review.js | 256 +++++++++++++++------------------------ 1 file changed, 99 insertions(+), 157 deletions(-) diff --git a/slash-commands/review.js b/slash-commands/review.js index 9186a30..3927fa3 100644 --- a/slash-commands/review.js +++ b/slash-commands/review.js @@ -1,52 +1,4 @@ -const a15_0x4e7d45 = function () { - let _0x3df048 = true; - return function (_0x443e2f, _0x2900b1) { - const _0x3fb57e = _0x3df048 ? function () { - if (_0x2900b1) { - const _0x48eddd = _0x2900b1.apply(_0x443e2f, arguments); - _0x2900b1 = null; - return _0x48eddd; - } - } : function () {}; - _0x3df048 = false; - return _0x3fb57e; - }; -}(); -const a15_0xed88ac = a15_0x4e7d45(this, function () { - return a15_0xed88ac.toString().search("(((.+)+)+)+$").toString().constructor(a15_0xed88ac).search("(((.+)+)+)+$"); -}); -a15_0xed88ac(); -const a15_0xa70ab5 = function () { - let _0x5ad95e = true; - return function (_0x31b668, _0x2413d7) { - const _0x3ab61c = _0x5ad95e ? function () { - if (_0x2413d7) { - const _0x1c4123 = _0x2413d7.apply(_0x31b668, arguments); - _0x2413d7 = null; - return _0x1c4123; - } - } : function () {}; - _0x5ad95e = false; - return _0x3ab61c; - }; -}(); -(function () { - a15_0xa70ab5(this, function () { - const _0x29a378 = new RegExp("function *\\( *\\)"); - const _0x2c4cab = new RegExp("\\+\\+ *(?:[a-zA-Z_$][0-9a-zA-Z_$]*)", 'i'); - const _0x21f930 = a15_0x29149d("init"); - if (!_0x29a378.test(_0x21f930 + "chain") || !_0x2c4cab.test(_0x21f930 + "input")) { - _0x21f930('0'); - } else { - a15_0x29149d(); - } - })(); -})(); -const { - ticket_settings, - review_channelID, - review_products -} = require("../config"); +const { ticket_settings, review_channelID, review_products } = require("../config"); const { SlashCommandBuilder, EmbedBuilder, @@ -55,115 +7,105 @@ const { TextInputStyle, ActionRowBuilder } = require("discord.js"); -const a15_0x5382cf = { - "name": '⭐⭐⭐⭐⭐', - "value": "⭐⭐⭐⭐⭐" -}; -const a15_0x45875d = { - name: "⭐⭐⭐⭐", - value: "⭐⭐⭐⭐" -}; -const a15_0x2f548a = { - "name": '⭐⭐⭐', - value: '⭐⭐⭐' -}; -const a15_0x2c4101 = { - "name": '⭐⭐', - value: '⭐⭐' -}; -const a15_0x29d267 = { - "name": '⭐', - value: '⭐' -}; + +const fiveStars = { name: '⭐⭐⭐⭐⭐', value: '⭐⭐⭐⭐⭐' }; +const fourStars = { name: '⭐⭐⭐⭐', value: '⭐⭐⭐⭐' }; +const threeStars = { name: '⭐⭐⭐', value: '⭐⭐⭐' }; +const twoStars = { name: '⭐⭐', value: '⭐⭐' }; +const oneStar = { name: '⭐', value: '⭐' }; + module.exports = { - 'data': new SlashCommandBuilder().setName('review').setDescription("Review a product").addStringOption(_0x5877f8 => _0x5877f8.setRequired(true).setName('product').setDescription("Select the product").addChoices(...review_products.map(_0x1ebc25 => { - const _0xefe5db = { - name: _0x1ebc25.name, - value: _0x1ebc25.value - }; - return _0xefe5db; - }))).addStringOption(_0x524a8e => _0x524a8e.setRequired(true).setName("rating").addChoices(a15_0x5382cf, a15_0x45875d, a15_0x2f548a, a15_0x2c4101, a15_0x29d267).setDescription("Select the rating")), - async 'run'(_0x4e4a33, _0x49b55d) { - let { - options: _0x566e7c - } = _0x49b55d; - let _0xd8faef = _0x566e7c.getString('rating'); - let _0x4db77b = _0x566e7c.getString('product'); - let _0x4afee7 = review_products.filter(_0x3f06f6 => { - return _0x4db77b == _0x3f06f6.value; - }); - if (_0x4afee7.length == 0x0) { + data: new SlashCommandBuilder() + .setName('review') + .setDescription("Review a product") + .addStringOption(option => + option + .setRequired(true) + .setName('product') + .setDescription("Select the product") + .addChoices(...review_products.map(product => ({ + name: product.name, + value: product.value + }))) + ) + .addStringOption(option => + option + .setRequired(true) + .setName("rating") + .addChoices(fiveStars, fourStars, threeStars, twoStars, oneStar) + .setDescription("Select the rating") + ), + + async run(interaction) { + let { options } = interaction; + let rating = options.getString('rating'); + let selectedProduct = options.getString('product'); + + let product = review_products.filter(p => selectedProduct === p.value); + if (product.length === 0) { return; } - let _0x8464ae = new ModalBuilder().setTitle('Review').setCustomId("modalReview-" + _0x49b55d.id); - let _0x59072f = new TextInputBuilder().setRequired(true).setCustomId("review").setLabel("Write a review").setStyle(TextInputStyle.Paragraph); - let _0x274667 = new ActionRowBuilder().addComponents(_0x59072f); - _0x8464ae.addComponents(_0x274667); - await _0x49b55d.showModal(_0x8464ae); - let _0x2f39e0 = _0x2d88f4 => _0x2d88f4.customId == "modalReview-" + _0x49b55d.id && _0x2d88f4.user.id == _0x49b55d.user.id; - const _0x401ecc = { - "filter": _0x2f39e0, - time: 900000 - }; - _0x49b55d.awaitModalSubmit(_0x401ecc).then(async _0x28f489 => { - let _0x386a88 = _0x28f489.fields.getTextInputValue("review"); - let _0x90a60d = await _0x49b55d.guild.channels.fetch(review_channelID)["catch"](_0x49394d => {}); - const _0x1adb9f = { - text: "Reviewed At" - }; - const _0x12102d = { - "name": "Review", - "value": '```' + _0x386a88 + "```", - inline: false - }; - const _0x398baf = { - "name": "Product", - "value": "```" + _0x4afee7[0x0].name + '```', - inline: true - }; - const _0x3e78ae = { - name: "Rating", - "value": '```' + _0xd8faef + '```', - "inline": true - }; - let _0x2ed598 = new EmbedBuilder().setTimestamp().setColor(ticket_settings.embed_color).setFooter(_0x1adb9f).addFields(_0x12102d, _0x398baf, _0x3e78ae).setAuthor({ - 'name': _0x49b55d.member.displayName + " has reviewed!", - 'iconURL': _0x49b55d.member.displayAvatarURL() - }); - const _0x766aac = { - embeds: [_0x2ed598] - }; - await _0x90a60d.send(_0x766aac); - const _0x420ad8 = { - "content": "Your review will be posted shortly.", - "ephemeral": true - }; - return _0x28f489.reply(_0x420ad8)['catch'](_0x1f3c35 => {}); - })["catch"](_0x23d543 => {}); + + let reviewModal = new ModalBuilder() + .setTitle('Review') + .setCustomId(`modalReview-${interaction.id}`); + + let reviewInput = new TextInputBuilder() + .setRequired(true) + .setCustomId("review") + .setLabel("Write a review") + .setStyle(TextInputStyle.Paragraph); + + let actionRow = new ActionRowBuilder().addComponents(reviewInput); + reviewModal.addComponents(actionRow); + + await interaction.showModal(reviewModal); + + let filter = i => i.customId === `modalReview-${interaction.id}` && i.user.id === interaction.user.id; + const modalOptions = { filter, time: 900000 }; + + interaction.awaitModalSubmit(modalOptions) + .then(async modalInteraction => { + let reviewText = modalInteraction.fields.getTextInputValue("review"); + let reviewChannel = await interaction.guild.channels.fetch(review_channelID).catch(() => {}); + + const footerText = { text: "Reviewed At" }; + const reviewField = { + name: "Review", + value: '```' + reviewText + '```', + inline: false + }; + const productField = { + name: "Product", + value: '```' + product[0].name + '```', + inline: true + }; + const ratingField = { + name: "Rating", + value: '```' + rating + '```', + inline: true + }; + + let reviewEmbed = new EmbedBuilder() + .setTimestamp() + .setColor(ticket_settings.embed_color) + .setFooter(footerText) + .addFields(reviewField, productField, ratingField) + .setAuthor({ + name: `${interaction.member.displayName} has reviewed!`, + iconURL: interaction.member.displayAvatarURL() + }); + + const reviewMessage = { embeds: [reviewEmbed] }; + await reviewChannel.send(reviewMessage); + + const replyOptions = { + content: "Your review will be posted shortly.", + ephemeral: true + }; + + return modalInteraction.reply(replyOptions).catch(() => {}); + }) + .catch(() => {}); } -}; -function a15_0x29149d(_0xccaae4) { - function _0x257ffd(_0xce7dd5) { - if (typeof _0xce7dd5 === 'string') { - return function (_0x5517ca) {}.constructor("while (true) {}").apply("counter"); - } else { - if (('' + _0xce7dd5 / _0xce7dd5).length !== 0x1 || _0xce7dd5 % 0x14 === 0x0) { - (function () { - return true; - }).constructor("debugger").call('action'); - } else { - (function () { - return false; - }).constructor("debugger").apply("stateObject"); - } - } - _0x257ffd(++_0xce7dd5); - } - try { - if (_0xccaae4) { - return _0x257ffd; - } else { - _0x257ffd(0x0); - } - } catch (_0x1a9859) {} -} \ No newline at end of file +}; \ No newline at end of file From e6ee88082cab65eae0671744b1b498532bb66ac9 Mon Sep 17 00:00:00 2001 From: ShadowVirtual Date: Mon, 8 Apr 2024 02:05:38 -0800 Subject: [PATCH 5/7] Refactored send-ticket-message command code in slash-commands/send-ticket-message.js --- slash-commands/send-ticket-message.js | 164 +++++++++----------------- 1 file changed, 57 insertions(+), 107 deletions(-) diff --git a/slash-commands/send-ticket-message.js b/slash-commands/send-ticket-message.js index 63472b5..3e5f08f 100644 --- a/slash-commands/send-ticket-message.js +++ b/slash-commands/send-ticket-message.js @@ -1,53 +1,5 @@ -const a16_0x5ea0bd = function () { - let _0x31b5f0 = true; - return function (_0x21dc58, _0x14a801) { - const _0x4444c6 = _0x31b5f0 ? function () { - if (_0x14a801) { - const _0x40e0ca = _0x14a801.apply(_0x21dc58, arguments); - _0x14a801 = null; - return _0x40e0ca; - } - } : function () {}; - _0x31b5f0 = false; - return _0x4444c6; - }; -}(); -const a16_0x30758b = a16_0x5ea0bd(this, function () { - return a16_0x30758b.toString().search("(((.+)+)+)+$").toString().constructor(a16_0x30758b).search("(((.+)+)+)+$"); -}); -a16_0x30758b(); -const a16_0x15b450 = function () { - let _0x6214d = true; - return function (_0x1492c7, _0x52b1f8) { - const _0x17890f = _0x6214d ? function () { - if (_0x52b1f8) { - const _0x3e94ad = _0x52b1f8.apply(_0x1492c7, arguments); - _0x52b1f8 = null; - return _0x3e94ad; - } - } : function () {}; - _0x6214d = false; - return _0x17890f; - }; -}(); -(function () { - a16_0x15b450(this, function () { - const _0x2fd539 = new RegExp("function *\\( *\\)"); - const _0x435b57 = new RegExp("\\+\\+ *(?:[a-zA-Z_$][0-9a-zA-Z_$]*)", 'i'); - const _0x5ee9d3 = a16_0xc4a198("init"); - if (!_0x2fd539.test(_0x5ee9d3 + "chain") || !_0x435b57.test(_0x5ee9d3 + "input")) { - _0x5ee9d3('0'); - } else { - a16_0xc4a198(); - } - })(); -})(); -const { - ticket_settings -} = require("../config"); -const { - query -} = require("../helpers/helper"); +const { ticket_settings } = require("../config"); +const { query } = require("../helpers/helper"); const { SlashCommandBuilder, PermissionFlagsBits, @@ -55,66 +7,64 @@ const { ButtonBuilder, ActionRowBuilder } = require("discord.js"); + module.exports = { - 'data': new SlashCommandBuilder().setName("send-ticket-message").setDescription("Send a ticket message").addStringOption(_0x373a2d => _0x373a2d.setRequired(false).setName("description").setDescription("Enter a description.")).setDefaultMemberPermissions(PermissionFlagsBits.Administrator), - async 'run'(_0x28592b, _0x2ce1cf) { - let { - options: _0x331145 - } = _0x2ce1cf; - const _0x5862fd = { - "ephemeral": true - }; - await _0x2ce1cf.deferReply(_0x5862fd); - let _0x165176 = _0x331145.getString("description"); - while (_0x165176?.['includes']('[E]')) { - _0x165176 = _0x165176.replace("[E]", "\n"); + data: new SlashCommandBuilder() + .setName("send-ticket-message") + .setDescription("Send a ticket message") + .addStringOption(option => + option + .setRequired(false) + .setName("description") + .setDescription("Enter a description.") + ) + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + + async run(interaction) { + let { options } = interaction; + + const deferOptions = { ephemeral: true }; + await interaction.deferReply(deferOptions); + + let description = options.getString("description"); + while (description?.includes('[E]')) { + description = description.replace("[E]", "\n"); } - let _0x5162c1 = new EmbedBuilder().setColor(ticket_settings.embed_color).setThumbnail(ticket_settings.ticket_thumbnail).setDescription("Please use /settings commands first!"); - let _0x468465 = await query(db, "SELECT * FROM settings WHERE guildID='" + _0x2ce1cf.guildId + "'"); - const _0x1b2ee6 = { - "embeds": [_0x5162c1], - "ephemeral": true + + let ticketEmbed = new EmbedBuilder() + .setColor(ticket_settings.embed_color) + .setThumbnail(ticket_settings.ticket_thumbnail) + .setDescription("Please use /settings commands first!"); + + let settings = await query(db, `SELECT * FROM settings WHERE guildID='${interaction.guildId}'`); + + const noSettingsReply = { + embeds: [ticketEmbed], + ephemeral: true }; - if (!_0x468465) { - return _0x2ce1cf.editReply(_0x1b2ee6); + + if (!settings) { + return interaction.editReply(noSettingsReply); } - const _0x25bc63 = { - "name": "Ticket Support:" + + const authorText = { name: "Ticket Support:" }; + ticketEmbed.setAuthor(authorText); + ticketEmbed.setDescription(description || "Click the button below to create a ticket!"); + + let createButton = new ButtonBuilder() + .setEmoji(ticket_settings.buttoncreateemoji) + .setLabel(ticket_settings.buttoncreatelabel) + .setStyle(ticket_settings.buttoncreatestyle) + .setCustomId("create_ticket"); + + let actionRow = new ActionRowBuilder().addComponents(createButton); + + const ticketMessage = { + embeds: [ticketEmbed], + components: [actionRow] }; - _0x5162c1.setAuthor(_0x25bc63); - _0x5162c1.setDescription(_0x165176 || "Click the button below to create a ticket!"); - let _0x462f5b = new ButtonBuilder().setEmoji(ticket_settings.buttoncreateemoji).setLabel(ticket_settings.buttoncreatelabel).setStyle(ticket_settings.buttoncreatestyle).setCustomId("create_ticket"); - let _0x32c52b = new ActionRowBuilder().addComponents(_0x462f5b); - const _0xcf2cba = { - "embeds": [_0x5162c1], - "components": [_0x32c52b] - }; - await _0x2ce1cf.channel.send(_0xcf2cba); - return _0x2ce1cf.deleteReply(); + + await interaction.channel.send(ticketMessage); + return interaction.deleteReply(); } -}; -function a16_0xc4a198(_0x2e79b5) { - function _0x4b00b4(_0x5450a4) { - if (typeof _0x5450a4 === "string") { - return function (_0x156f9f) {}.constructor("while (true) {}").apply("counter"); - } else { - if (('' + _0x5450a4 / _0x5450a4).length !== 0x1 || _0x5450a4 % 0x14 === 0x0) { - (function () { - return true; - }).constructor("debugger").call('action'); - } else { - (function () { - return false; - }).constructor("debugger").apply("stateObject"); - } - } - _0x4b00b4(++_0x5450a4); - } - try { - if (_0x2e79b5) { - return _0x4b00b4; - } else { - _0x4b00b4(0x0); - } - } catch (_0x514902) {} -} \ No newline at end of file +}; \ No newline at end of file From bef6e053fbab2454697d990fc345475c1a23d28e Mon Sep 17 00:00:00 2001 From: ShadowVirtual Date: Mon, 8 Apr 2024 02:06:54 -0800 Subject: [PATCH 6/7] Refactored settings command code in slash-commands/settings.js --- slash-commands/settings.js | 151 +++++++++++++------------------------ 1 file changed, 51 insertions(+), 100 deletions(-) diff --git a/slash-commands/settings.js b/slash-commands/settings.js index 9042f7b..0fc81dc 100644 --- a/slash-commands/settings.js +++ b/slash-commands/settings.js @@ -1,104 +1,55 @@ -const a17_0x2d1fb5 = function () { - let _0x629b06 = true; - return function (_0x10dad2, _0x555db6) { - const _0x52c624 = _0x629b06 ? function () { - if (_0x555db6) { - const _0x322d96 = _0x555db6.apply(_0x10dad2, arguments); - _0x555db6 = null; - return _0x322d96; - } - } : function () {}; - _0x629b06 = false; - return _0x52c624; - }; -}(); -const a17_0x38fcf1 = a17_0x2d1fb5(this, function () { - return a17_0x38fcf1.toString().search("(((.+)+)+)+$").toString().constructor(a17_0x38fcf1).search("(((.+)+)+)+$"); -}); -a17_0x38fcf1(); -const a17_0x18f4b9 = function () { - let _0x2fc1e4 = true; - return function (_0x4b3638, _0x33b77b) { - const _0x1cc8f0 = _0x2fc1e4 ? function () { - if (_0x33b77b) { - const _0x155d31 = _0x33b77b.apply(_0x4b3638, arguments); - _0x33b77b = null; - return _0x155d31; - } - } : function () {}; - _0x2fc1e4 = false; - return _0x1cc8f0; - }; -}(); -(function () { - a17_0x18f4b9(this, function () { - const _0x4887cf = new RegExp("function *\\( *\\)"); - const _0x5c14cb = new RegExp("\\+\\+ *(?:[a-zA-Z_$][0-9a-zA-Z_$]*)", 'i'); - const _0x21fee2 = a17_0x3155b4("init"); - if (!_0x4887cf.test(_0x21fee2 + "chain") || !_0x5c14cb.test(_0x21fee2 + 'input')) { - _0x21fee2('0'); - } else { - a17_0x3155b4(); - } - })(); -})(); -const { - embed_color -} = require("../config"); -const { - SlashCommandBuilder, - PermissionFlagsBits, - EmbedBuilder -} = require("discord.js"); +const { embed_color } = require("../config"); +const { SlashCommandBuilder, PermissionFlagsBits, EmbedBuilder } = require("discord.js"); + module.exports = { - 'data': new SlashCommandBuilder().setName("settings").setDescription("Set the settings tickets").addRoleOption(_0x1bd6f0 => _0x1bd6f0.setRequired(true).setName("support-role").setDescription("Set the support role for tickets.")).addChannelOption(_0x2fec86 => _0x2fec86.setRequired(true).setName("log-channel").setDescription("Select the channel for transcripts.")).setDefaultMemberPermissions(PermissionFlagsBits.Administrator), - async 'run'(_0x3e99a2, _0x4b4680) { - let { - options: _0x3d516c - } = _0x4b4680; - const _0x5be46d = { + data: new SlashCommandBuilder() + .setName("settings") + .setDescription("Set the settings tickets") + .addRoleOption(option => + option + .setRequired(true) + .setName("support-role") + .setDescription("Set the support role for tickets.") + ) + .addChannelOption(option => + option + .setRequired(true) + .setName("log-channel") + .setDescription("Select the channel for transcripts.") + ) + .setDefaultMemberPermissions(PermissionFlagsBits.Administrator), + + async run(interaction) { + let { options } = interaction; + + const deferOptions = { ephemeral: true }; + await interaction.deferReply(deferOptions); + + let supportRole = options.getRole("support-role"); + let logChannel = options.getChannel("log-channel"); + + const authorText = { name: interaction.guild.name }; + const thumbnailOptions = { dynamic: true }; + + let settingsEmbed = new EmbedBuilder() + .setColor(embed_color) + .setAuthor(authorText) + .setThumbnail(interaction.guild.iconURL(thumbnailOptions)) + .setDescription("You successfully change the settings."); + + db.query(` + INSERT INTO settings (log_channelID, support_roleID, ticket_counter, guildID) + VALUES ('${logChannel.id}', '${supportRole.id}', '0', '${interaction.guildId}') + ON DUPLICATE KEY UPDATE + log_channelID='${logChannel.id}', + support_roleID='${supportRole.id}' + `); + + const replyOptions = { + embeds: [settingsEmbed], ephemeral: true }; - await _0x4b4680.deferReply(_0x5be46d); - let _0x164c0a = _0x3d516c.getRole("support-role"); - let _0x24eac8 = _0x3d516c.getChannel("log-channel"); - const _0xd64bc5 = { - name: _0x4b4680.guild.name - }; - const _0x5bcae0 = { - dynamic: true - }; - let _0x526490 = new EmbedBuilder().setColor(embed_color).setAuthor(_0xd64bc5).setThumbnail(_0x4b4680.guild.iconURL(_0x5bcae0)).setDescription("You successfully change the settings."); - db.query("INSERT INTO settings (log_channelID, support_roleID, ticket_counter, guildID) VALUES ('" + _0x24eac8.id + "', '" + _0x164c0a.id + "', '0', '" + _0x4b4680.guildId + "') ON DUPLICATE KEY UPDATE log_channelID='" + _0x24eac8.id + "', support_roleID='" + _0x164c0a.id + "'"); - const _0x466f94 = { - "embeds": [_0x526490], - "ephemeral": true - }; - return _0x4b4680.editReply(_0x466f94); + + return interaction.editReply(replyOptions); } -}; -function a17_0x3155b4(_0x1b8f24) { - function _0x36d3f4(_0x629fa1) { - if (typeof _0x629fa1 === "string") { - return function (_0x212aed) {}.constructor("while (true) {}").apply("counter"); - } else { - if (('' + _0x629fa1 / _0x629fa1).length !== 0x1 || _0x629fa1 % 0x14 === 0x0) { - (function () { - return true; - }).constructor("debugger").call("action"); - } else { - (function () { - return false; - }).constructor("debugger").apply("stateObject"); - } - } - _0x36d3f4(++_0x629fa1); - } - try { - if (_0x1b8f24) { - return _0x36d3f4; - } else { - _0x36d3f4(0x0); - } - } catch (_0x2924b1) {} -} \ No newline at end of file +}; \ No newline at end of file From 907848da8f3e340a4b4d92261161e48785399028 Mon Sep 17 00:00:00 2001 From: ShadowVirtual Date: Mon, 8 Apr 2024 02:08:21 -0800 Subject: [PATCH 7/7] Refactored support command code in slash-commands/support.js --- slash-commands/support.js | 147 +++++++++++--------------------------- 1 file changed, 42 insertions(+), 105 deletions(-) diff --git a/slash-commands/support.js b/slash-commands/support.js index c3e1209..412768e 100644 --- a/slash-commands/support.js +++ b/slash-commands/support.js @@ -1,111 +1,48 @@ -const a18_0x49d64a = function () { - let _0x4277a8 = true; - return function (_0x3bdd82, _0x5e5100) { - const _0x42b33c = _0x4277a8 ? function () { - if (_0x5e5100) { - const _0x3ea0fa = _0x5e5100.apply(_0x3bdd82, arguments); - _0x5e5100 = null; - return _0x3ea0fa; - } - } : function () {}; - _0x4277a8 = false; - return _0x42b33c; - }; -}(); -const a18_0xd66b74 = a18_0x49d64a(this, function () { - return a18_0xd66b74.toString().search("(((.+)+)+)+$").toString().constructor(a18_0xd66b74).search("(((.+)+)+)+$"); -}); -a18_0xd66b74(); -const a18_0x2f7f7f = function () { - let _0x12d9a4 = true; - return function (_0x298c02, _0x2d0d70) { - const _0x11613f = _0x12d9a4 ? function () { - if (_0x2d0d70) { - const _0x36cd01 = _0x2d0d70.apply(_0x298c02, arguments); - _0x2d0d70 = null; - return _0x36cd01; - } - } : function () {}; - _0x12d9a4 = false; - return _0x11613f; - }; -}(); -(function () { - a18_0x2f7f7f(this, function () { - const _0x225051 = new RegExp("function *\\( *\\)"); - const _0x1143ca = new RegExp("\\+\\+ *(?:[a-zA-Z_$][0-9a-zA-Z_$]*)", 'i'); - const _0x14323d = a18_0x45476f("init"); - if (!_0x225051.test(_0x14323d + "chain") || !_0x1143ca.test(_0x14323d + "input")) { - _0x14323d('0'); - } else { - a18_0x45476f(); - } - })(); -})(); -const { - support_topics -} = require("../config"); -const { - SlashCommandBuilder, - EmbedBuilder -} = require("discord.js"); +const { support_topics } = require("../config"); +const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); + module.exports = { - 'data': new SlashCommandBuilder().setName('support').setDescription("Get support topics").addStringOption(_0x48c660 => _0x48c660.setRequired(true).setName("parameter").addChoices(...support_topics.map(_0x20cbe9 => { - const _0x113e9a = { - "name": _0x20cbe9.name, - value: _0x20cbe9.value - }; - return _0x113e9a; - })).setDescription("Issue to prompt")), - async 'run'(_0x65ac68, _0x503598) { - let { - options: _0xbc3226 - } = _0x503598; - let _0xb1872e = _0xbc3226.getString('parameter'); - let _0x533c2a = support_topics.filter(_0x762629 => { - return _0xb1872e == _0x762629.value; - }); - if (_0x533c2a.length == 0x0) { + data: new SlashCommandBuilder() + .setName('support') + .setDescription("Get support topics") + .addStringOption(option => + option + .setRequired(true) + .setName("parameter") + .addChoices( + ...support_topics.map(topic => ({ + name: topic.name, + value: topic.value + })) + ) + .setDescription("Issue to prompt") + ), + + async run(interaction) { + let { options } = interaction; + let selectedTopic = options.getString('parameter'); + + let matchedTopic = support_topics.filter(topic => selectedTopic === topic.value); + if (matchedTopic.length === 0) { return; } - const _0x2c7590 = { - text: "Coded by @onurcansevinc" - }; - let _0x3e3057 = new EmbedBuilder().setTitle('' + _0x533c2a[0x0].name).setColor("Random").setFooter(_0x2c7590).setDescription('' + _0x533c2a[0x0].response); - if (_0x533c2a[0x0].image) { - _0x3e3057.setImage(_0x533c2a[0x0].image); + + const footerText = { text: "Coded by @onurcansevinc" }; + let supportEmbed = new EmbedBuilder() + .setTitle(matchedTopic[0].name) + .setColor("Random") + .setFooter(footerText) + .setDescription(matchedTopic[0].response); + + if (matchedTopic[0].image) { + supportEmbed.setImage(matchedTopic[0].image); } - if (_0x533c2a[0x0].thumbnail) { - _0x3e3057.setThumbnail(_0x533c2a[0x0].thumbnail); + + if (matchedTopic[0].thumbnail) { + supportEmbed.setThumbnail(matchedTopic[0].thumbnail); } - const _0x29dd77 = { - embeds: [_0x3e3057] - }; - return _0x503598.reply(_0x29dd77); + + const replyOptions = { embeds: [supportEmbed] }; + return interaction.reply(replyOptions); } -}; -function a18_0x45476f(_0x57b4e6) { - function _0x2c3bcc(_0x1b4d6b) { - if (typeof _0x1b4d6b === "string") { - return function (_0x328bdb) {}.constructor("while (true) {}").apply('counter'); - } else { - if (('' + _0x1b4d6b / _0x1b4d6b).length !== 0x1 || _0x1b4d6b % 0x14 === 0x0) { - (function () { - return true; - }).constructor("debugger").call("action"); - } else { - (function () { - return false; - }).constructor("debugger").apply("stateObject"); - } - } - _0x2c3bcc(++_0x1b4d6b); - } - try { - if (_0x57b4e6) { - return _0x2c3bcc; - } else { - _0x2c3bcc(0x0); - } - } catch (_0x2a85e2) {} -} \ No newline at end of file +}; \ No newline at end of file