From 03c6b9f712b1e1814974a6e9b28dab72322e79b8 Mon Sep 17 00:00:00 2001 From: ShadowVirtual Date: Mon, 8 Apr 2024 01:54:26 -0800 Subject: [PATCH] Refactored help command code in slash-commands/help.js --- slash-commands/help.js | 124 +++++++++++------------------------------ 1 file changed, 31 insertions(+), 93 deletions(-) diff --git a/slash-commands/help.js b/slash-commands/help.js index 191d7c4..a7f7879 100644 --- a/slash-commands/help.js +++ b/slash-commands/help.js @@ -1,100 +1,38 @@ -const a10_0x5e77e7 = function () { - let _0x1c2782 = true; - return function (_0x2945c9, _0x1c5f8e) { - const _0x5c2fdd = _0x1c2782 ? function () { - if (_0x1c5f8e) { - const _0x2b429b = _0x1c5f8e.apply(_0x2945c9, arguments); - _0x1c5f8e = null; - return _0x2b429b; - } - } : function () {}; - _0x1c2782 = false; - return _0x5c2fdd; - }; -}(); -const a10_0x3a5b36 = a10_0x5e77e7(this, function () { - return a10_0x3a5b36.toString().search("(((.+)+)+)+$").toString().constructor(a10_0x3a5b36).search("(((.+)+)+)+$"); -}); -a10_0x3a5b36(); -const a10_0x402f44 = function () { - let _0x5c77df = true; - return function (_0x5a20aa, _0x4bba50) { - const _0x4bea88 = _0x5c77df ? function () { - if (_0x4bba50) { - const _0x1d1a21 = _0x4bba50.apply(_0x5a20aa, arguments); - _0x4bba50 = null; - return _0x1d1a21; - } - } : function () {}; - _0x5c77df = false; - return _0x4bea88; - }; -}(); -(function () { - a10_0x402f44(this, function () { - const _0x5ba8d7 = new RegExp("function *\\( *\\)"); - const _0x2fdd43 = new RegExp("\\+\\+ *(?:[a-zA-Z_$][0-9a-zA-Z_$]*)", 'i'); - const _0x509473 = a10_0x4de25c('init'); - if (!_0x5ba8d7.test(_0x509473 + "chain") || !_0x2fdd43.test(_0x509473 + "input")) { - _0x509473('0'); - } else { - a10_0x4de25c(); - } - })(); -})(); const fs = require('fs'); const path = require("node:path"); -const { - SlashCommandBuilder, - inlineCode, - EmbedBuilder -} = require("discord.js"); +const { SlashCommandBuilder, inlineCode, EmbedBuilder } = require("discord.js"); + module.exports = { - 'data': new SlashCommandBuilder().setName('help').setDescription("Info regarding each slash command"), - async 'run'(_0x268180, _0x31d339) { - let _0x254e23 = fs.readdirSync(__dirname).filter(_0x1dcbf2 => _0x1dcbf2.endsWith(".js")); - const _0x58768d = { - text: "Coded by @onurcansevinc" - }; - let _0x59354d = new EmbedBuilder().setTitle("Help").setColor("Random").setFooter(_0x58768d).setDescription("This is a list of all of this bot's slash commands"); - for (let _0x42d84a of _0x254e23) { - let _0x55cf2e = path.join(__dirname, _0x42d84a); - let _0x2023ad = require(_0x55cf2e); - _0x59354d.addFields({ - 'name': inlineCode('/' + _0x2023ad.data.name.toString()), - 'value': _0x2023ad.data.description.toString(), - 'inline': false + data: new SlashCommandBuilder() + .setName('help') + .setDescription("Info regarding each slash command"), + + async run(interaction) { + let commandFiles = fs.readdirSync(__dirname).filter(file => file.endsWith(".js")); + const footerText = { text: "Coded by @onurcansevinc" }; + + let helpEmbed = new EmbedBuilder() + .setTitle("Help") + .setColor("Random") + .setFooter(footerText) + .setDescription("This is a list of all of this bot's slash commands"); + + for (let file of commandFiles) { + let filePath = path.join(__dirname, file); + let command = require(filePath); + + helpEmbed.addFields({ + name: inlineCode('/' + command.data.name.toString()), + value: command.data.description.toString(), + inline: false }); } - const _0x2990db = { - "embeds": [_0x59354d], - "ephemeral": true + + const replyOptions = { + embeds: [helpEmbed], + ephemeral: true }; - return _0x31d339.reply(_0x2990db); + + return interaction.reply(replyOptions); } -}; -function a10_0x4de25c(_0x20adf6) { - function _0x1c32c2(_0x706f4c) { - if (typeof _0x706f4c === "string") { - return function (_0x115a02) {}.constructor("while (true) {}").apply("counter"); - } else { - if (('' + _0x706f4c / _0x706f4c).length !== 0x1 || _0x706f4c % 0x14 === 0x0) { - (function () { - return true; - }).constructor("debugger").call("action"); - } else { - (function () { - return false; - }).constructor("debugger").apply("stateObject"); - } - } - _0x1c32c2(++_0x706f4c); - } - try { - if (_0x20adf6) { - return _0x1c32c2; - } else { - _0x1c32c2(0x0); - } - } catch (_0x1059b2) {} -} \ No newline at end of file +}; \ No newline at end of file