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