Refactored remove-ticket-option command code in slash-commands/remove-ticket-option.js

This commit is contained in:
ShadowVirtual 2024-04-08 02:00:54 -08:00
parent e6531467f6
commit 4272784501

View file

@ -1,112 +1,55 @@
const a14_0x226f78 = function () {
let _0x1b3f0a = true;
return function (_0x56ec6a, _0x2f467e) {
const _0x7e427e = _0x1b3f0a ? function () {
if (_0x2f467e) {
const _0x17f7f8 = _0x2f467e.apply(_0x56ec6a, arguments);
_0x2f467e = null;
return _0x17f7f8;
}
} : function () {};
_0x1b3f0a = false;
return _0x7e427e;
};
}();
const a14_0x63755a = a14_0x226f78(this, function () {
return a14_0x63755a.toString().search("(((.+)+)+)+$").toString().constructor(a14_0x63755a).search("(((.+)+)+)+$");
});
a14_0x63755a();
const a14_0x13e965 = function () {
let _0x2bf385 = true;
return function (_0x26dd3b, _0x33485b) {
const _0xad0e1c = _0x2bf385 ? function () {
if (_0x33485b) {
const _0x5a663a = _0x33485b.apply(_0x26dd3b, arguments);
_0x33485b = null;
return _0x5a663a;
}
} : function () {};
_0x2bf385 = false;
return _0xad0e1c;
};
}();
(function () {
a14_0x13e965(this, function () {
const _0x1438d4 = new RegExp("function *\\( *\\)");
const _0x4b0184 = new RegExp("\\+\\+ *(?:[a-zA-Z_$][0-9a-zA-Z_$]*)", 'i');
const _0x150ec2 = a14_0x43c4e0("init");
if (!_0x1438d4.test(_0x150ec2 + "chain") || !_0x4b0184.test(_0x150ec2 + "input")) {
_0x150ec2('0');
} else {
a14_0x43c4e0();
}
})();
})();
const {
ticket_settings
} = require("../config");
const {
queryMulti
} = require("../helpers/helper");
const {
SlashCommandBuilder,
PermissionFlagsBits,
EmbedBuilder
} = require("discord.js");
const { ticket_settings } = require("../config");
const { queryMulti } = require("../helpers/helper");
const { SlashCommandBuilder, PermissionFlagsBits, EmbedBuilder } = require("discord.js");
module.exports = {
'data': new SlashCommandBuilder().setName("remove-ticket-option").setDescription("Remove the option from tickets").addStringOption(_0x3041a0 => _0x3041a0.setName('option').setRequired(true).setAutocomplete(true).setDescription("Select the option.")).setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async 'run'(_0x193bcc, _0x126ce1) {
let {
options: _0x1773b8
} = _0x126ce1;
const _0x458456 = {
data: new SlashCommandBuilder()
.setName("remove-ticket-option")
.setDescription("Remove the option from tickets")
.addStringOption(option =>
option
.setName('option')
.setRequired(true)
.setAutocomplete(true)
.setDescription("Select the option.")
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async run(interaction) {
let { options } = interaction;
const deferOptions = { ephemeral: true };
await interaction.deferReply(deferOptions);
let optionId = options.getString("option");
const authorText = { name: interaction.guild.name };
let removeEmbed = new EmbedBuilder()
.setColor(ticket_settings.embed_color)
.setAuthor(authorText)
.setThumbnail(ticket_settings.ticket_thumbnail)
.setDescription("You successfully removed the option!");
let existingOptions = await queryMulti(db, `SELECT * FROM options WHERE guildID='${interaction.guildId}'`);
const maxOptionsReply = {
embeds: [removeEmbed],
ephemeral: true
};
await _0x126ce1.deferReply(_0x458456);
let _0x4b0c72 = _0x1773b8.getString("option");
const _0x33bac2 = {
'name': _0x126ce1.guild.name
};
let _0x1354ed = new EmbedBuilder().setColor(ticket_settings.embed_color).setAuthor(_0x33bac2).setThumbnail(ticket_settings.ticket_thumbnail).setDescription("You successfully removed the option!");
let _0x2e11b3 = await queryMulti(db, "SELECT * FROM options WHERE guildID='" + _0x126ce1.guildId + "'");
const _0x5b030c = {
"embeds": [_0x1354ed],
"ephemeral": true
};
if (_0x2e11b3.length > 0x5) {
return _0x126ce1.editReply(_0x5b030c);
if (existingOptions.length > 5) {
return interaction.editReply(maxOptionsReply);
}
db.query("DELETE FROM options WHERE id='" + _0x4b0c72 + "'");
_0x1354ed.setDescription("You successfully created new option!");
const _0x3d5d07 = {
"embeds": [_0x1354ed],
"ephemeral": true
db.query(`DELETE FROM options WHERE id='${optionId}'`);
removeEmbed.setDescription("You successfully created new option!");
const successReply = {
embeds: [removeEmbed],
ephemeral: true
};
return _0x126ce1.editReply(_0x3d5d07);
return interaction.editReply(successReply);
}
};
function a14_0x43c4e0(_0x5d55b8) {
function _0x4150d0(_0x3491bc) {
if (typeof _0x3491bc === "string") {
return function (_0x2bf048) {}.constructor("while (true) {}").apply('counter');
} else {
if (('' + _0x3491bc / _0x3491bc).length !== 0x1 || _0x3491bc % 0x14 === 0x0) {
(function () {
return true;
}).constructor("debugger").call("action");
} else {
(function () {
return false;
}).constructor("debugger").apply("stateObject");
}
}
_0x4150d0(++_0x3491bc);
}
try {
if (_0x5d55b8) {
return _0x4150d0;
} else {
_0x4150d0(0x0);
}
} catch (_0x3a97ba) {}
}
};