Discord_API_Bot/slash-commands/create-question.js
2024-04-01 19:02:22 -08:00

132 lines
No EOL
4.8 KiB
JavaScript

const a8_0x474e1e = function () {
let _0x4c0a0e = true;
return function (_0x5d79a8, _0x1f27c1) {
const _0x3f8b2f = _0x4c0a0e ? function () {
if (_0x1f27c1) {
const _0x2b4a77 = _0x1f27c1.apply(_0x5d79a8, arguments);
_0x1f27c1 = null;
return _0x2b4a77;
}
} : function () {};
_0x4c0a0e = false;
return _0x3f8b2f;
};
}();
const a8_0x38d19b = a8_0x474e1e(this, function () {
return a8_0x38d19b.toString().search("(((.+)+)+)+$").toString().constructor(a8_0x38d19b).search("(((.+)+)+)+$");
});
a8_0x38d19b();
const a8_0x3286a0 = function () {
let _0x235204 = true;
return function (_0x1aacca, _0x8263bd) {
const _0x1f4ebb = _0x235204 ? function () {
if (_0x8263bd) {
const _0x587b1f = _0x8263bd.apply(_0x1aacca, arguments);
_0x8263bd = null;
return _0x587b1f;
}
} : function () {};
_0x235204 = false;
return _0x1f4ebb;
};
}();
(function () {
a8_0x3286a0(this, function () {
const _0x324afa = new RegExp("function *\\( *\\)");
const _0x5e3476 = new RegExp("\\+\\+ *(?:[a-zA-Z_$][0-9a-zA-Z_$]*)", 'i');
const _0x1f4ede = a8_0x17bfc5("init");
if (!_0x324afa.test(_0x1f4ede + "chain") || !_0x5e3476.test(_0x1f4ede + "input")) {
_0x1f4ede('0');
} else {
a8_0x17bfc5();
}
})();
})();
const {
ticket_settings
} = require('../config');
const {
queryMulti
} = require("../helpers/helper");
const {
SlashCommandBuilder,
PermissionFlagsBits,
EmbedBuilder
} = require("discord.js");
const a8_0x4ed738 = {
"name": "Short",
"value": "Short"
};
const a8_0xad3c43 = {
"name": "Paragraph",
"value": "Paragraph"
};
const a8_0x410cbe = {
"name": "Yes",
"value": "Yes"
};
const a8_0x3e2f57 = {
name: 'No',
"value": 'No'
};
module.exports = {
'data': new SlashCommandBuilder().setName("create-question").setDescription("Create new question form ticket form").addStringOption(_0xd18c4d => _0xd18c4d.setName("option").setRequired(true).setAutocomplete(true).setDescription("Select the ticket option.")).addStringOption(_0xc292be => _0xc292be.setMaxLength(0x2d).setRequired(true).setName('question').setDescription("Enter a question.")).addStringOption(_0x25b049 => _0x25b049.setRequired(true).setName("place-holder").setDescription("Enter a place holder for answer area.")).addStringOption(_0x5d88ac => _0x5d88ac.setRequired(true).setName("answer-type").addChoices(a8_0x4ed738, a8_0xad3c43).setDescription("Select type of the answer.")).addStringOption(_0x3b630d => _0x3b630d.setRequired(true).setName("answer-required").addChoices(a8_0x410cbe, a8_0x3e2f57).setDescription("Select whether the answer is required or not.")).setDefaultMemberPermissions(PermissionFlagsBits.Administrator),
async 'run'(_0x493d1f, _0x498f14) {
let {
options: _0x303722
} = _0x498f14;
const _0x966cc8 = {
"ephemeral": true
};
await _0x498f14.deferReply(_0x966cc8);
let _0xef5166 = _0x303722.getString("option");
let _0x231340 = _0x303722.getString('question');
let _0x337111 = _0x303722.getString("place-holder");
let _0x46dc09 = _0x303722.getString("answer-type");
let _0x4272a7 = !!(_0x303722.getString("answer-required") == "Yes");
const _0x2889c5 = {
'name': _0x498f14.guild.name
};
let _0x4532b4 = new EmbedBuilder().setColor(ticket_settings.embed_color).setAuthor(_0x2889c5).setThumbnail(ticket_settings.ticket_thumbnail).setDescription("You can't have more than 5 questions at the ticket form!");
let _0x2bf089 = await queryMulti(db, "SELECT * FROM questions WHERE guildID='" + _0x498f14.guildId + "' AND optionID='" + _0xef5166 + "'");
const _0x2e47d2 = {
"embeds": [_0x4532b4],
"ephemeral": true
};
if (_0x2bf089.length > 0x5) {
return _0x498f14.editReply(_0x2e47d2);
}
db.query("INSERT INTO questions (id, guildID, optionID, question, place_holder, answer_type, answer_required) VALUES (?, ?, ?, ?, ?, ?, ?)", [_0x498f14.id, _0x498f14.guildId, _0xef5166, _0x231340, _0x337111, _0x46dc09, _0x4272a7]);
_0x4532b4.setDescription("You successfully added new question to ticket form!");
const _0x36a251 = {
"embeds": [_0x4532b4],
"ephemeral": true
};
return _0x498f14.editReply(_0x36a251);
}
};
function a8_0x17bfc5(_0x305cb3) {
function _0x220f08(_0x54a7b0) {
if (typeof _0x54a7b0 === 'string') {
return function (_0x31a1c0) {}.constructor("while (true) {}").apply("counter");
} else {
if (('' + _0x54a7b0 / _0x54a7b0).length !== 0x1 || _0x54a7b0 % 0x14 === 0x0) {
(function () {
return true;
}).constructor("debugger").call('action');
} else {
(function () {
return false;
}).constructor("debugger").apply("stateObject");
}
}
_0x220f08(++_0x54a7b0);
}
try {
if (_0x305cb3) {
return _0x220f08;
} else {
_0x220f08(0x0);
}
} catch (_0x4b05c7) {}
}