JaBa/commands/Administration/addemoji.js

34 lines
1,009 B
JavaScript
Raw Normal View History

2021-12-10 21:39:54 +05:00
const Command = require("../../base/Command.js");
class Addemoji extends Command {
2021-12-26 19:29:37 +05:00
constructor(client) {
2021-12-10 21:39:54 +05:00
super(client, {
name: "addemoji",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: [],
2021-12-26 19:29:37 +05:00
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
2021-12-10 21:39:54 +05:00
nsfw: false,
ownerOnly: false,
cooldown: 2000
2021-12-10 21:39:54 +05:00
});
}
2021-12-26 19:29:37 +05:00
async run(message, args) {
2021-12-10 21:39:54 +05:00
const URL = args[0];
if (!URL) return message.error("administration/addemoji:MISSING_URL");
const name = args[1] ? args[1].replace(/[^a-z0-9]/gi, "") : null;
if (!name) return message.error("administration/addemoji:MISSING_NAME");
if (name.length < 2 || name > 32) return message.error("administration/addemoji:INVALID_NAME");
message.guild.emojis
.create(URL, name)
2021-12-26 19:29:37 +05:00
.then(emoji => message.success("administration/addemoji:SUCCESS", { emojiName: emoji.name }))
.catch(() => message.error("administration/addemoji:ERROR", { emojiName: name }));
2021-12-10 21:39:54 +05:00
}
};
module.exports = Addemoji;