2023-07-03 21:13:08 +05:00
|
|
|
const { SlashCommandBuilder, parseEmoji, PermissionsBitField } = require("discord.js");
|
2022-08-06 20:47:47 +05:00
|
|
|
const BaseCommand = require("../../base/BaseCommand");
|
|
|
|
|
|
|
|
class Stealemoji extends BaseCommand {
|
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../../base/Client")} client
|
2022-08-06 20:47:47 +05:00
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("stealemoji")
|
|
|
|
.setDescription(client.translate("administration/stealemoji:DESCRIPTION"))
|
2023-06-15 19:46:27 +05:00
|
|
|
.setDescriptionLocalizations({
|
2023-07-05 00:58:06 +05:00
|
|
|
uk: client.translate("administration/stealemoji:DESCRIPTION", null, "uk-UA"),
|
|
|
|
ru: client.translate("administration/stealemoji:DESCRIPTION", null, "ru-RU"),
|
2023-06-15 19:46:27 +05:00
|
|
|
})
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDMPermission(false)
|
2023-07-03 21:13:08 +05:00
|
|
|
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild)
|
2023-07-05 00:58:06 +05:00
|
|
|
.addStringOption(option =>
|
|
|
|
option
|
|
|
|
.setName("emoji")
|
|
|
|
.setDescription(client.translate("common:EMOJI"))
|
|
|
|
.setDescriptionLocalizations({
|
|
|
|
uk: client.translate("common:EMOJI", null, "uk-UA"),
|
|
|
|
ru: client.translate("common:EMOJI", null, "ru-RU"),
|
|
|
|
})
|
|
|
|
.setRequired(true),
|
|
|
|
),
|
2022-08-06 20:47:47 +05:00
|
|
|
dirname: __dirname,
|
2022-12-15 21:02:38 +05:00
|
|
|
ownerOnly: false,
|
2022-08-06 20:47:47 +05:00
|
|
|
});
|
|
|
|
}
|
2024-02-06 21:45:53 +05:00
|
|
|
|
2022-08-06 20:47:47 +05:00
|
|
|
/**
|
|
|
|
*
|
2023-11-05 16:03:23 +05:00
|
|
|
* @param {import("../../base/Client")} client
|
2022-08-06 20:47:47 +05:00
|
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
2022-08-09 23:48:33 +05:00
|
|
|
* @param {Object} data
|
2022-08-06 20:47:47 +05:00
|
|
|
*/
|
|
|
|
async execute(client, interaction) {
|
2023-01-09 01:39:13 +05:00
|
|
|
const parsedEmoji = parseEmoji(interaction.options.getString("emoji")),
|
|
|
|
ext = parsedEmoji.animated ? "gif" : "png";
|
2022-08-06 20:47:47 +05:00
|
|
|
|
|
|
|
interaction.guild.emojis
|
|
|
|
.create({
|
|
|
|
name: parsedEmoji.name,
|
2022-12-15 21:02:38 +05:00
|
|
|
attachment: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${ext}`,
|
2022-08-06 20:47:47 +05:00
|
|
|
})
|
2023-07-05 00:58:06 +05:00
|
|
|
.then(emoji =>
|
|
|
|
interaction.success("administration/stealemoji:SUCCESS", {
|
|
|
|
emoji: emoji.name,
|
|
|
|
}, { ephemeral: true }),
|
|
|
|
)
|
2022-08-06 20:47:47 +05:00
|
|
|
.catch(e => {
|
|
|
|
interaction.error("administration/stealemoji:ERROR", {
|
2022-08-09 23:48:33 +05:00
|
|
|
emoji: parsedEmoji.name,
|
2022-12-15 21:02:38 +05:00
|
|
|
e,
|
2022-08-06 20:47:47 +05:00
|
|
|
}, { ephemeral: true });
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2023-07-05 00:58:06 +05:00
|
|
|
module.exports = Stealemoji;
|