From e6531467f6d45aa9c267f83ea83535047ec867de Mon Sep 17 00:00:00 2001 From: ShadowVirtual Date: Mon, 8 Apr 2024 01:59:39 -0800 Subject: [PATCH] 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