Refactored send-ticket-message command code in slash-commands/send-ticket-message.js

This commit is contained in:
ShadowVirtual 2024-04-08 02:05:38 -08:00
parent 487db19ed2
commit e6ee88082c

View file

@ -1,53 +1,5 @@
const a16_0x5ea0bd = function () { const { ticket_settings } = require("../config");
let _0x31b5f0 = true; const { query } = require("../helpers/helper");
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 { const {
SlashCommandBuilder, SlashCommandBuilder,
PermissionFlagsBits, PermissionFlagsBits,
@ -55,66 +7,64 @@ const {
ButtonBuilder, ButtonBuilder,
ActionRowBuilder ActionRowBuilder
} = require("discord.js"); } = require("discord.js");
module.exports = { 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), data: new SlashCommandBuilder()
async 'run'(_0x28592b, _0x2ce1cf) { .setName("send-ticket-message")
let { .setDescription("Send a ticket message")
options: _0x331145 .addStringOption(option =>
} = _0x2ce1cf; option
const _0x5862fd = { .setRequired(false)
"ephemeral": true .setName("description")
}; .setDescription("Enter a description.")
await _0x2ce1cf.deferReply(_0x5862fd); )
let _0x165176 = _0x331145.getString("description"); .setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
while (_0x165176?.['includes']('[E]')) {
_0x165176 = _0x165176.replace("[E]", "\n"); 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 + "'"); let ticketEmbed = new EmbedBuilder()
const _0x1b2ee6 = { .setColor(ticket_settings.embed_color)
"embeds": [_0x5162c1], .setThumbnail(ticket_settings.ticket_thumbnail)
"ephemeral": true .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!"); await interaction.channel.send(ticketMessage);
let _0x462f5b = new ButtonBuilder().setEmoji(ticket_settings.buttoncreateemoji).setLabel(ticket_settings.buttoncreatelabel).setStyle(ticket_settings.buttoncreatestyle).setCustomId("create_ticket"); return interaction.deleteReply();
let _0x32c52b = new ActionRowBuilder().addComponents(_0x462f5b);
const _0xcf2cba = {
"embeds": [_0x5162c1],
"components": [_0x32c52b]
};
await _0x2ce1cf.channel.send(_0xcf2cba);
return _0x2ce1cf.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) {}
}