2022-08-06 20:47:47 +05:00
|
|
|
const { SlashCommandBuilder, parseEmoji, PermissionFlagsBits } = require("discord.js");
|
|
|
|
const BaseCommand = require("../../base/BaseCommand");
|
|
|
|
|
|
|
|
class Stealemoji extends BaseCommand {
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
constructor(client) {
|
|
|
|
super({
|
|
|
|
command: new SlashCommandBuilder()
|
|
|
|
.setName("stealemoji")
|
|
|
|
.setDescription(client.translate("administration/stealemoji:DESCRIPTION"))
|
2022-10-13 00:05:36 +05:00
|
|
|
.setDMPermission(false)
|
2022-11-09 21:33:45 +05:00
|
|
|
.setDefaultMemberPermissions(PermissionFlagsBits.Administrator)
|
2022-08-06 20:47:47 +05:00
|
|
|
.addStringOption(option => option.setName("emoji")
|
|
|
|
.setDescription(client.translate("common:EMOJI"))
|
|
|
|
.setRequired(true)),
|
|
|
|
aliases: [],
|
|
|
|
dirname: __dirname,
|
2022-12-15 21:02:38 +05:00
|
|
|
ownerOnly: false,
|
2022-08-06 20:47:47 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
*/
|
|
|
|
async onLoad() {
|
|
|
|
//...
|
|
|
|
}
|
|
|
|
/**
|
|
|
|
*
|
|
|
|
* @param {import("../../base/JaBa")} client
|
|
|
|
* @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) {
|
|
|
|
const parsedEmoji = parseEmoji(interaction.options.getString("emoji"));
|
|
|
|
const ext = parsedEmoji.animated ? "gif" : "png";
|
|
|
|
|
|
|
|
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
|
|
|
})
|
|
|
|
.then(emoji => interaction.success("administration/stealemoji:SUCCESS", {
|
2022-12-15 21:02:38 +05:00
|
|
|
emoji: emoji.name,
|
2022-08-06 20:47:47 +05:00
|
|
|
}, { ephemeral: true }))
|
|
|
|
.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 });
|
|
|
|
});
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
module.exports = Stealemoji;
|