Refactored remove-ticket-option, remove-question, link, info, and help command code in slash-commands
This commit is contained in:
parent
4272784501
commit
487db19ed2
1 changed files with 99 additions and 157 deletions
|
@ -1,52 +1,4 @@
|
||||||
const a15_0x4e7d45 = function () {
|
const { ticket_settings, review_channelID, review_products } = require("../config");
|
||||||
let _0x3df048 = true;
|
|
||||||
return function (_0x443e2f, _0x2900b1) {
|
|
||||||
const _0x3fb57e = _0x3df048 ? function () {
|
|
||||||
if (_0x2900b1) {
|
|
||||||
const _0x48eddd = _0x2900b1.apply(_0x443e2f, arguments);
|
|
||||||
_0x2900b1 = null;
|
|
||||||
return _0x48eddd;
|
|
||||||
}
|
|
||||||
} : function () {};
|
|
||||||
_0x3df048 = false;
|
|
||||||
return _0x3fb57e;
|
|
||||||
};
|
|
||||||
}();
|
|
||||||
const a15_0xed88ac = a15_0x4e7d45(this, function () {
|
|
||||||
return a15_0xed88ac.toString().search("(((.+)+)+)+$").toString().constructor(a15_0xed88ac).search("(((.+)+)+)+$");
|
|
||||||
});
|
|
||||||
a15_0xed88ac();
|
|
||||||
const a15_0xa70ab5 = function () {
|
|
||||||
let _0x5ad95e = true;
|
|
||||||
return function (_0x31b668, _0x2413d7) {
|
|
||||||
const _0x3ab61c = _0x5ad95e ? function () {
|
|
||||||
if (_0x2413d7) {
|
|
||||||
const _0x1c4123 = _0x2413d7.apply(_0x31b668, arguments);
|
|
||||||
_0x2413d7 = null;
|
|
||||||
return _0x1c4123;
|
|
||||||
}
|
|
||||||
} : function () {};
|
|
||||||
_0x5ad95e = false;
|
|
||||||
return _0x3ab61c;
|
|
||||||
};
|
|
||||||
}();
|
|
||||||
(function () {
|
|
||||||
a15_0xa70ab5(this, function () {
|
|
||||||
const _0x29a378 = new RegExp("function *\\( *\\)");
|
|
||||||
const _0x2c4cab = new RegExp("\\+\\+ *(?:[a-zA-Z_$][0-9a-zA-Z_$]*)", 'i');
|
|
||||||
const _0x21f930 = a15_0x29149d("init");
|
|
||||||
if (!_0x29a378.test(_0x21f930 + "chain") || !_0x2c4cab.test(_0x21f930 + "input")) {
|
|
||||||
_0x21f930('0');
|
|
||||||
} else {
|
|
||||||
a15_0x29149d();
|
|
||||||
}
|
|
||||||
})();
|
|
||||||
})();
|
|
||||||
const {
|
|
||||||
ticket_settings,
|
|
||||||
review_channelID,
|
|
||||||
review_products
|
|
||||||
} = require("../config");
|
|
||||||
const {
|
const {
|
||||||
SlashCommandBuilder,
|
SlashCommandBuilder,
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
|
@ -55,115 +7,105 @@ const {
|
||||||
TextInputStyle,
|
TextInputStyle,
|
||||||
ActionRowBuilder
|
ActionRowBuilder
|
||||||
} = require("discord.js");
|
} = require("discord.js");
|
||||||
const a15_0x5382cf = {
|
|
||||||
"name": '⭐⭐⭐⭐⭐',
|
const fiveStars = { name: '⭐⭐⭐⭐⭐', value: '⭐⭐⭐⭐⭐' };
|
||||||
"value": "⭐⭐⭐⭐⭐"
|
const fourStars = { name: '⭐⭐⭐⭐', value: '⭐⭐⭐⭐' };
|
||||||
};
|
const threeStars = { name: '⭐⭐⭐', value: '⭐⭐⭐' };
|
||||||
const a15_0x45875d = {
|
const twoStars = { name: '⭐⭐', value: '⭐⭐' };
|
||||||
name: "⭐⭐⭐⭐",
|
const oneStar = { name: '⭐', value: '⭐' };
|
||||||
value: "⭐⭐⭐⭐"
|
|
||||||
};
|
|
||||||
const a15_0x2f548a = {
|
|
||||||
"name": '⭐⭐⭐',
|
|
||||||
value: '⭐⭐⭐'
|
|
||||||
};
|
|
||||||
const a15_0x2c4101 = {
|
|
||||||
"name": '⭐⭐',
|
|
||||||
value: '⭐⭐'
|
|
||||||
};
|
|
||||||
const a15_0x29d267 = {
|
|
||||||
"name": '⭐',
|
|
||||||
value: '⭐'
|
|
||||||
};
|
|
||||||
module.exports = {
|
module.exports = {
|
||||||
'data': new SlashCommandBuilder().setName('review').setDescription("Review a product").addStringOption(_0x5877f8 => _0x5877f8.setRequired(true).setName('product').setDescription("Select the product").addChoices(...review_products.map(_0x1ebc25 => {
|
data: new SlashCommandBuilder()
|
||||||
const _0xefe5db = {
|
.setName('review')
|
||||||
name: _0x1ebc25.name,
|
.setDescription("Review a product")
|
||||||
value: _0x1ebc25.value
|
.addStringOption(option =>
|
||||||
};
|
option
|
||||||
return _0xefe5db;
|
.setRequired(true)
|
||||||
}))).addStringOption(_0x524a8e => _0x524a8e.setRequired(true).setName("rating").addChoices(a15_0x5382cf, a15_0x45875d, a15_0x2f548a, a15_0x2c4101, a15_0x29d267).setDescription("Select the rating")),
|
.setName('product')
|
||||||
async 'run'(_0x4e4a33, _0x49b55d) {
|
.setDescription("Select the product")
|
||||||
let {
|
.addChoices(...review_products.map(product => ({
|
||||||
options: _0x566e7c
|
name: product.name,
|
||||||
} = _0x49b55d;
|
value: product.value
|
||||||
let _0xd8faef = _0x566e7c.getString('rating');
|
})))
|
||||||
let _0x4db77b = _0x566e7c.getString('product');
|
)
|
||||||
let _0x4afee7 = review_products.filter(_0x3f06f6 => {
|
.addStringOption(option =>
|
||||||
return _0x4db77b == _0x3f06f6.value;
|
option
|
||||||
});
|
.setRequired(true)
|
||||||
if (_0x4afee7.length == 0x0) {
|
.setName("rating")
|
||||||
|
.addChoices(fiveStars, fourStars, threeStars, twoStars, oneStar)
|
||||||
|
.setDescription("Select the rating")
|
||||||
|
),
|
||||||
|
|
||||||
|
async run(interaction) {
|
||||||
|
let { options } = interaction;
|
||||||
|
let rating = options.getString('rating');
|
||||||
|
let selectedProduct = options.getString('product');
|
||||||
|
|
||||||
|
let product = review_products.filter(p => selectedProduct === p.value);
|
||||||
|
if (product.length === 0) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
let _0x8464ae = new ModalBuilder().setTitle('Review').setCustomId("modalReview-" + _0x49b55d.id);
|
|
||||||
let _0x59072f = new TextInputBuilder().setRequired(true).setCustomId("review").setLabel("Write a review").setStyle(TextInputStyle.Paragraph);
|
let reviewModal = new ModalBuilder()
|
||||||
let _0x274667 = new ActionRowBuilder().addComponents(_0x59072f);
|
.setTitle('Review')
|
||||||
_0x8464ae.addComponents(_0x274667);
|
.setCustomId(`modalReview-${interaction.id}`);
|
||||||
await _0x49b55d.showModal(_0x8464ae);
|
|
||||||
let _0x2f39e0 = _0x2d88f4 => _0x2d88f4.customId == "modalReview-" + _0x49b55d.id && _0x2d88f4.user.id == _0x49b55d.user.id;
|
let reviewInput = new TextInputBuilder()
|
||||||
const _0x401ecc = {
|
.setRequired(true)
|
||||||
"filter": _0x2f39e0,
|
.setCustomId("review")
|
||||||
time: 900000
|
.setLabel("Write a review")
|
||||||
};
|
.setStyle(TextInputStyle.Paragraph);
|
||||||
_0x49b55d.awaitModalSubmit(_0x401ecc).then(async _0x28f489 => {
|
|
||||||
let _0x386a88 = _0x28f489.fields.getTextInputValue("review");
|
let actionRow = new ActionRowBuilder().addComponents(reviewInput);
|
||||||
let _0x90a60d = await _0x49b55d.guild.channels.fetch(review_channelID)["catch"](_0x49394d => {});
|
reviewModal.addComponents(actionRow);
|
||||||
const _0x1adb9f = {
|
|
||||||
text: "Reviewed At"
|
await interaction.showModal(reviewModal);
|
||||||
};
|
|
||||||
const _0x12102d = {
|
let filter = i => i.customId === `modalReview-${interaction.id}` && i.user.id === interaction.user.id;
|
||||||
"name": "Review",
|
const modalOptions = { filter, time: 900000 };
|
||||||
"value": '```' + _0x386a88 + "```",
|
|
||||||
|
interaction.awaitModalSubmit(modalOptions)
|
||||||
|
.then(async modalInteraction => {
|
||||||
|
let reviewText = modalInteraction.fields.getTextInputValue("review");
|
||||||
|
let reviewChannel = await interaction.guild.channels.fetch(review_channelID).catch(() => {});
|
||||||
|
|
||||||
|
const footerText = { text: "Reviewed At" };
|
||||||
|
const reviewField = {
|
||||||
|
name: "Review",
|
||||||
|
value: '```' + reviewText + '```',
|
||||||
inline: false
|
inline: false
|
||||||
};
|
};
|
||||||
const _0x398baf = {
|
const productField = {
|
||||||
"name": "Product",
|
name: "Product",
|
||||||
"value": "```" + _0x4afee7[0x0].name + '```',
|
value: '```' + product[0].name + '```',
|
||||||
inline: true
|
inline: true
|
||||||
};
|
};
|
||||||
const _0x3e78ae = {
|
const ratingField = {
|
||||||
name: "Rating",
|
name: "Rating",
|
||||||
"value": '```' + _0xd8faef + '```',
|
value: '```' + rating + '```',
|
||||||
"inline": true
|
inline: true
|
||||||
};
|
};
|
||||||
let _0x2ed598 = new EmbedBuilder().setTimestamp().setColor(ticket_settings.embed_color).setFooter(_0x1adb9f).addFields(_0x12102d, _0x398baf, _0x3e78ae).setAuthor({
|
|
||||||
'name': _0x49b55d.member.displayName + " has reviewed!",
|
let reviewEmbed = new EmbedBuilder()
|
||||||
'iconURL': _0x49b55d.member.displayAvatarURL()
|
.setTimestamp()
|
||||||
|
.setColor(ticket_settings.embed_color)
|
||||||
|
.setFooter(footerText)
|
||||||
|
.addFields(reviewField, productField, ratingField)
|
||||||
|
.setAuthor({
|
||||||
|
name: `${interaction.member.displayName} has reviewed!`,
|
||||||
|
iconURL: interaction.member.displayAvatarURL()
|
||||||
});
|
});
|
||||||
const _0x766aac = {
|
|
||||||
embeds: [_0x2ed598]
|
const reviewMessage = { embeds: [reviewEmbed] };
|
||||||
|
await reviewChannel.send(reviewMessage);
|
||||||
|
|
||||||
|
const replyOptions = {
|
||||||
|
content: "Your review will be posted shortly.",
|
||||||
|
ephemeral: true
|
||||||
};
|
};
|
||||||
await _0x90a60d.send(_0x766aac);
|
|
||||||
const _0x420ad8 = {
|
return modalInteraction.reply(replyOptions).catch(() => {});
|
||||||
"content": "Your review will be posted shortly.",
|
})
|
||||||
"ephemeral": true
|
.catch(() => {});
|
||||||
};
|
|
||||||
return _0x28f489.reply(_0x420ad8)['catch'](_0x1f3c35 => {});
|
|
||||||
})["catch"](_0x23d543 => {});
|
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
function a15_0x29149d(_0xccaae4) {
|
|
||||||
function _0x257ffd(_0xce7dd5) {
|
|
||||||
if (typeof _0xce7dd5 === 'string') {
|
|
||||||
return function (_0x5517ca) {}.constructor("while (true) {}").apply("counter");
|
|
||||||
} else {
|
|
||||||
if (('' + _0xce7dd5 / _0xce7dd5).length !== 0x1 || _0xce7dd5 % 0x14 === 0x0) {
|
|
||||||
(function () {
|
|
||||||
return true;
|
|
||||||
}).constructor("debugger").call('action');
|
|
||||||
} else {
|
|
||||||
(function () {
|
|
||||||
return false;
|
|
||||||
}).constructor("debugger").apply("stateObject");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
_0x257ffd(++_0xce7dd5);
|
|
||||||
}
|
|
||||||
try {
|
|
||||||
if (_0xccaae4) {
|
|
||||||
return _0x257ffd;
|
|
||||||
} else {
|
|
||||||
_0x257ffd(0x0);
|
|
||||||
}
|
|
||||||
} catch (_0x1a9859) {}
|
|
||||||
}
|
|
Loading…
Reference in a new issue