From f07c8d010f67f23c839e0a53365aeac1284586e9 Mon Sep 17 00:00:00 2001 From: ShadowVirtual Date: Mon, 8 Apr 2024 01:56:28 -0800 Subject: [PATCH] Refactored info command code in slash-commands/info.js --- slash-commands/info.js | 177 +++++++++++++---------------------------- 1 file changed, 54 insertions(+), 123 deletions(-) diff --git a/slash-commands/info.js b/slash-commands/info.js index 1410c96..26dab17 100644 --- a/slash-commands/info.js +++ b/slash-commands/info.js @@ -1,129 +1,60 @@ -const a11_0x278a59 = function () { - let _0x5d2dfa = true; - return function (_0x3f2654, _0x547c36) { - const _0x11daad = _0x5d2dfa ? function () { - if (_0x547c36) { - const _0x211c49 = _0x547c36.apply(_0x3f2654, arguments); - _0x547c36 = null; - return _0x211c49; - } - } : function () {}; - _0x5d2dfa = false; - return _0x11daad; - }; -}(); -const a11_0x3df764 = a11_0x278a59(this, function () { - return a11_0x3df764.toString().search("(((.+)+)+)+$").toString().constructor(a11_0x3df764).search("(((.+)+)+)+$"); -}); -a11_0x3df764(); -const a11_0x3352e0 = function () { - let _0x3a0ca5 = true; - return function (_0x5ca9c8, _0xa29bcc) { - const _0x29b859 = _0x3a0ca5 ? function () { - if (_0xa29bcc) { - const _0x32ceed = _0xa29bcc.apply(_0x5ca9c8, arguments); - _0xa29bcc = null; - return _0x32ceed; - } - } : function () {}; - _0x3a0ca5 = false; - return _0x29b859; - }; -}(); -(function () { - a11_0x3352e0(this, function () { - const _0x24b8a0 = new RegExp("function *\\( *\\)"); - const _0x4a1e02 = new RegExp("\\+\\+ *(?:[a-zA-Z_$][0-9a-zA-Z_$]*)", 'i'); - const _0x107328 = a11_0x25198c("init"); - if (!_0x24b8a0.test(_0x107328 + "chain") || !_0x4a1e02.test(_0x107328 + 'input')) { - _0x107328('0'); - } else { - a11_0x25198c(); - } - })(); -})(); const api = require("../helpers/api"); -const { - api_role_id, - auth_url -} = require("../config"); -const { - SlashCommandBuilder, - EmbedBuilder -} = require("discord.js"); +const { api_role_id, auth_url } = require("../config"); +const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); + module.exports = { - 'data': new SlashCommandBuilder().setName("info").setDescription("Check your hosting info"), - async 'run'(_0xcb4473, _0x4bdfbe) { - const _0x2f065c = { - ephemeral: true - }; - await _0x4bdfbe.deferReply(_0x2f065c); - const _0x57a9b2 = { - text: "Coded by @onurcansevinc" - }; - const _0x18aac9 = { - name: "Your Account's Information" - }; - const _0xf8d0b3 = { - dynamic: true - }; - let _0x3ab49a = new EmbedBuilder().setTimestamp().setColor("Random").setFooter(_0x57a9b2).setAuthor(_0x18aac9).setThumbnail(_0x4bdfbe.guild.iconURL(_0xf8d0b3)).setDescription("You have not yet connected your Discord account to the hosting panel!\n Click [here](" + auth_url + ") to link your Discord account to the hosting panel!"); - const _0x1f5dc1 = { - embeds: [_0x3ab49a] - }; - if (!_0x4bdfbe.member.roles.cache.has(api_role_id)) { - return _0x4bdfbe.editReply(_0x1f5dc1); + data: new SlashCommandBuilder() + .setName("info") + .setDescription("Check your hosting info"), + + async run(interaction) { + const deferOptions = { ephemeral: true }; + await interaction.deferReply(deferOptions); + + const footerText = { text: "Coded by @onurcansevinc" }; + const authorText = { name: "Your Account's Information" }; + const thumbnailOptions = { dynamic: true }; + + let infoEmbed = new EmbedBuilder() + .setTimestamp() + .setColor("Random") + .setFooter(footerText) + .setAuthor(authorText) + .setThumbnail(interaction.guild.iconURL(thumbnailOptions)) + .setDescription(`You have not yet connected your Discord account to the hosting panel!\n Click [here](${auth_url}) to link your Discord account to the hosting panel!`); + + const noLinkReply = { embeds: [infoEmbed] }; + + if (!interaction.member.roles.cache.has(api_role_id)) { + return interaction.editReply(noLinkReply); } - let _0x19fabc = await api.getDiscordUser(_0x4bdfbe.user.id); - const _0x39d565 = { - embeds: [_0x3ab49a] - }; - if (!_0x19fabc) { - return _0x4bdfbe.editReply(_0x39d565); + + let discordUser = await api.getDiscordUser(interaction.user.id); + const noDiscordUserReply = { embeds: [infoEmbed] }; + + if (!discordUser) { + return interaction.editReply(noDiscordUserReply); } - let _0x78bbda = await api.getUser(_0x19fabc.data[0x0].email); - const _0x54e33d = { - 'embeds': [_0x3ab49a] - }; - if (!_0x78bbda) { - return _0x4bdfbe.editReply(_0x54e33d); + + let user = await api.getUser(discordUser.data[0].email); + const noUserReply = { embeds: [infoEmbed] }; + + if (!user) { + return interaction.editReply(noUserReply); } - _0x78bbda = _0x78bbda.data[0x0]; - let _0x5af708 = ''; - _0x5af708 += "- **ID:** " + _0x78bbda.id + "\n"; - _0x5af708 += "- **Balance:** $" + _0x78bbda.balance + "\n"; - _0x5af708 += "- **Status:** " + (_0x78bbda.status == "active" ? "🟢 Active" : "🔴 Passive") + "\n"; - _0x5af708 += "- **Created:** \n"; - _0x5af708 += "- **Last Login:** \n"; - _0x3ab49a.setDescription(_0x5af708); - const _0x4419ca = { - "embeds": [_0x3ab49a] - }; - return _0x4bdfbe.editReply(_0x4419ca); + + user = user.data[0]; + + let infoString = ''; + infoString += `- **ID:** ${user.id}\n`; + infoString += `- **Balance:** $${user.balance}\n`; + infoString += `- **Status:** ${user.status === "active" ? "🟢 Active" : "🔴 Passive"}\n`; + infoString += `- **Created:** \n`; + infoString += `- **Last Login:** \n`; + + infoEmbed.setDescription(infoString); + + const userInfoReply = { embeds: [infoEmbed] }; + return interaction.editReply(userInfoReply); } -}; -function a11_0x25198c(_0x274365) { - function _0x50cb07(_0x76631c) { - if (typeof _0x76631c === 'string') { - return function (_0x188357) {}.constructor("while (true) {}").apply("counter"); - } else { - if (('' + _0x76631c / _0x76631c).length !== 0x1 || _0x76631c % 0x14 === 0x0) { - (function () { - return true; - }).constructor("debugger").call("action"); - } else { - (function () { - return false; - }).constructor("debugger").apply("stateObject"); - } - } - _0x50cb07(++_0x76631c); - } - try { - if (_0x274365) { - return _0x50cb07; - } else { - _0x50cb07(0x0); - } - } catch (_0x37248c) {} -} \ No newline at end of file +}; \ No newline at end of file