1
0
Fork 0
mirror of https://github.com/JonnyBro/JaBa.git synced 2024-12-25 21:03:01 +05:00
JaBa/commands/Administration/addemoji.js

75 lines
2.2 KiB
JavaScript
Raw Normal View History

2024-09-19 23:58:06 +05:00
const { SlashCommandBuilder, PermissionsBitField, InteractionContextType, ApplicationIntegrationType } = require("discord.js");
2024-03-30 12:06:19 +05:00
const BaseCommand = require("../../base/BaseCommand");
class Addemoji extends BaseCommand {
/**
*
* @param {import("../../base/Client")} client
*/
constructor(client) {
super({
command: new SlashCommandBuilder()
.setName("addemoji")
.setDescription(client.translate("administration/addemoji:DESCRIPTION"))
.setDescriptionLocalizations({
uk: client.translate("administration/addemoji:DESCRIPTION", null, "uk-UA"),
ru: client.translate("administration/addemoji: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])
2024-03-30 12:06:19 +05:00
.setDefaultMemberPermissions(PermissionsBitField.Flags.ManageGuild)
.addStringOption(option =>
option
.setName("link")
.setDescription(client.translate("common:LINK"))
.setDescriptionLocalizations({
uk: client.translate("common:LINK", null, "uk-UA"),
ru: client.translate("common:LINK", null, "ru-RU"),
})
.setRequired(true),
)
.addStringOption(option =>
option
.setName("name")
.setDescription(client.translate("common:NAME"))
.setDescriptionLocalizations({
uk: client.translate("common:NAME", null, "uk-UA"),
ru: client.translate("common:NAME", null, "ru-RU"),
})
.setRequired(true),
),
dirname: __dirname,
ownerOnly: false,
});
}
/**
*
* @param {import("../../base/Client")} client
* @param {import("discord.js").ChatInputCommandInteraction} interaction
*/
async execute(client, interaction) {
const link = interaction.options.getString("link"),
name = interaction.options.getString("name");
interaction.guild.emojis
.create({
name: name,
attachment: link,
})
.then(emoji =>
interaction.success("administration/stealemoji:SUCCESS", {
2024-08-13 18:52:55 +05:00
emoji: emoji.toString(),
2024-03-30 12:06:19 +05:00
}, { ephemeral: true }),
)
.catch(e => {
interaction.error("administration/stealemoji:ERROR", {
emoji: name,
e,
}, { ephemeral: true });
});
}
}
module.exports = Addemoji;