Refactored settings command code in slash-commands/settings.js

This commit is contained in:
ShadowVirtual 2024-04-08 02:06:54 -08:00
parent e6ee88082c
commit bef6e053fb

View file

@ -1,104 +1,55 @@
const a17_0x2d1fb5 = function () {
let _0x629b06 = true;
return function (_0x10dad2, _0x555db6) {
const _0x52c624 = _0x629b06 ? function () {
if (_0x555db6) {
const _0x322d96 = _0x555db6.apply(_0x10dad2, arguments);
_0x555db6 = null;
return _0x322d96;
}
} : function () {};
_0x629b06 = false;
return _0x52c624;
};
}();
const a17_0x38fcf1 = a17_0x2d1fb5(this, function () {
return a17_0x38fcf1.toString().search("(((.+)+)+)+$").toString().constructor(a17_0x38fcf1).search("(((.+)+)+)+$");
});
a17_0x38fcf1();
const a17_0x18f4b9 = function () {
let _0x2fc1e4 = true;
return function (_0x4b3638, _0x33b77b) {
const _0x1cc8f0 = _0x2fc1e4 ? function () {
if (_0x33b77b) {
const _0x155d31 = _0x33b77b.apply(_0x4b3638, arguments);
_0x33b77b = null;
return _0x155d31;
}
} : function () {};
_0x2fc1e4 = false;
return _0x1cc8f0;
};
}();
(function () {
a17_0x18f4b9(this, function () {
const _0x4887cf = new RegExp("function *\\( *\\)");
const _0x5c14cb = new RegExp("\\+\\+ *(?:[a-zA-Z_$][0-9a-zA-Z_$]*)", 'i');
const _0x21fee2 = a17_0x3155b4("init");
if (!_0x4887cf.test(_0x21fee2 + "chain") || !_0x5c14cb.test(_0x21fee2 + 'input')) {
_0x21fee2('0');
} else {
a17_0x3155b4();
}
})();
})();
const {
embed_color
} = require("../config");
const {
SlashCommandBuilder,
PermissionFlagsBits,
EmbedBuilder
} = require("discord.js");
const { embed_color } = require("../config");
const { SlashCommandBuilder, PermissionFlagsBits, EmbedBuilder } = require("discord.js");
module.exports = {
'data': new SlashCommandBuilder().setName("settings").setDescription("Set the settings tickets").addRoleOption(_0x1bd6f0 => _0x1bd6f0.setRequired(true).setName("support-role").setDescription("Set the support role for tickets.")).addChannelOption(_0x2fec86 => _0x2fec86.setRequired(true).setName("log-channel").setDescription("Select the channel for transcripts.")).setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async 'run'(_0x3e99a2, _0x4b4680) {
let {
options: _0x3d516c
} = _0x4b4680;
const _0x5be46d = {
data: new SlashCommandBuilder()
.setName("settings")
.setDescription("Set the settings tickets")
.addRoleOption(option =>
option
.setRequired(true)
.setName("support-role")
.setDescription("Set the support role for tickets.")
)
.addChannelOption(option =>
option
.setRequired(true)
.setName("log-channel")
.setDescription("Select the channel for transcripts.")
)
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async run(interaction) {
let { options } = interaction;
const deferOptions = { ephemeral: true };
await interaction.deferReply(deferOptions);
let supportRole = options.getRole("support-role");
let logChannel = options.getChannel("log-channel");
const authorText = { name: interaction.guild.name };
const thumbnailOptions = { dynamic: true };
let settingsEmbed = new EmbedBuilder()
.setColor(embed_color)
.setAuthor(authorText)
.setThumbnail(interaction.guild.iconURL(thumbnailOptions))
.setDescription("You successfully change the settings.");
db.query(`
INSERT INTO settings (log_channelID, support_roleID, ticket_counter, guildID)
VALUES ('${logChannel.id}', '${supportRole.id}', '0', '${interaction.guildId}')
ON DUPLICATE KEY UPDATE
log_channelID='${logChannel.id}',
support_roleID='${supportRole.id}'
`);
const replyOptions = {
embeds: [settingsEmbed],
ephemeral: true
};
await _0x4b4680.deferReply(_0x5be46d);
let _0x164c0a = _0x3d516c.getRole("support-role");
let _0x24eac8 = _0x3d516c.getChannel("log-channel");
const _0xd64bc5 = {
name: _0x4b4680.guild.name
};
const _0x5bcae0 = {
dynamic: true
};
let _0x526490 = new EmbedBuilder().setColor(embed_color).setAuthor(_0xd64bc5).setThumbnail(_0x4b4680.guild.iconURL(_0x5bcae0)).setDescription("You successfully change the settings.");
db.query("INSERT INTO settings (log_channelID, support_roleID, ticket_counter, guildID) VALUES ('" + _0x24eac8.id + "', '" + _0x164c0a.id + "', '0', '" + _0x4b4680.guildId + "') ON DUPLICATE KEY UPDATE log_channelID='" + _0x24eac8.id + "', support_roleID='" + _0x164c0a.id + "'");
const _0x466f94 = {
"embeds": [_0x526490],
"ephemeral": true
};
return _0x4b4680.editReply(_0x466f94);
return interaction.editReply(replyOptions);
}
};
function a17_0x3155b4(_0x1b8f24) {
function _0x36d3f4(_0x629fa1) {
if (typeof _0x629fa1 === "string") {
return function (_0x212aed) {}.constructor("while (true) {}").apply("counter");
} else {
if (('' + _0x629fa1 / _0x629fa1).length !== 0x1 || _0x629fa1 % 0x14 === 0x0) {
(function () {
return true;
}).constructor("debugger").call("action");
} else {
(function () {
return false;
}).constructor("debugger").apply("stateObject");
}
}
_0x36d3f4(++_0x629fa1);
}
try {
if (_0x1b8f24) {
return _0x36d3f4;
} else {
_0x36d3f4(0x0);
}
} catch (_0x2924b1) {}
}
};