From 907848da8f3e340a4b4d92261161e48785399028 Mon Sep 17 00:00:00 2001 From: ShadowVirtual Date: Mon, 8 Apr 2024 02:08:21 -0800 Subject: [PATCH] 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