1
0
Fork 0
mirror of https://github.com/JonnyBro/JaBa.git synced 2024-12-23 11:53:02 +05:00
JaBa/commands/Administration/stealemoji.js

64 lines
2 KiB
JavaScript
Raw Normal View History

2024-09-19 23:58:06 +05:00
const { SlashCommandBuilder, parseEmoji, PermissionsBitField, InteractionContextType, ApplicationIntegrationType } = require("discord.js");
const BaseCommand = require("../../base/BaseCommand");
class Stealemoji extends BaseCommand {
/**
*
2023-11-05 16:03:23 +05:00
* @param {import("../../base/Client")} client
*/
constructor(client) {
super({
command: new SlashCommandBuilder()
.setName("stealemoji")
.setDescription(client.translate("administration/stealemoji:DESCRIPTION"))
.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"),
})
2024-09-19 23:58:06 +05:00
.setIntegrationTypes([ApplicationIntegrationType.GuildInstall])
2024-09-14 19:52:56 +05:00
.setContexts([InteractionContextType.Guild])
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),
),
dirname: __dirname,
ownerOnly: false,
});
}
/**
*
2023-11-05 16:03:23 +05:00
* @param {import("../../base/Client")} client
* @param {import("discord.js").ChatInputCommandInteraction} interaction
*/
async execute(client, interaction) {
2024-02-09 23:26:57 +05:00
const parsedEmoji = parseEmoji(interaction.options.getString("emoji"));
interaction.guild.emojis
.create({
name: parsedEmoji.name,
2024-02-09 23:26:57 +05:00
attachment: `https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${parsedEmoji.animated ? "gif" : "png"}`,
})
2023-07-05 00:58:06 +05:00
.then(emoji =>
interaction.success("administration/stealemoji:SUCCESS", {
2024-08-13 18:52:55 +05:00
emoji: emoji.toString(),
2023-07-05 00:58:06 +05:00
}, { ephemeral: true }),
)
.catch(e => {
interaction.error("administration/stealemoji:ERROR", {
2022-08-09 23:48:33 +05:00
emoji: parsedEmoji.name,
e,
}, { ephemeral: true });
});
}
}
2023-07-05 00:58:06 +05:00
module.exports = Stealemoji;