2022-01-13 00:56:24 +05:00
|
|
|
const Command = require("../../base/Command");
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
class Addemoji extends Command {
|
|
|
|
constructor(client) {
|
|
|
|
super(client, {
|
|
|
|
name: "addemoji",
|
|
|
|
dirname: __dirname,
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: true,
|
|
|
|
aliases: ["adde"],
|
|
|
|
memberPermissions: ["MANAGE_GUILD"],
|
|
|
|
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
|
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: false,
|
|
|
|
cooldown: 1000
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async run(message, args) {
|
2022-01-28 01:34:04 +05:00
|
|
|
const url = args[0];
|
|
|
|
if (!url) return message.error("administration/addemoji:MISSING_URL");
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
const name = args[1] ? args[1].replace(/[^a-z0-9]/gi, "") : null;
|
|
|
|
if (!name) return message.error("administration/addemoji:MISSING_NAME");
|
2022-01-09 14:45:55 +05:00
|
|
|
if (name.length < 2 || name.length > 32) return message.error("administration/addemoji:INVALID_NAME");
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
message.guild.emojis
|
2022-01-28 01:34:04 +05:00
|
|
|
.create(url, name)
|
2022-01-05 00:24:57 +05:00
|
|
|
.then(emoji => message.success("administration/addemoji:SUCCESS", {
|
2022-01-28 01:34:04 +05:00
|
|
|
emoji: emoji.name
|
2022-01-05 00:24:57 +05:00
|
|
|
}))
|
|
|
|
.catch(() => message.error("administration/addemoji:ERROR", {
|
2022-01-28 01:34:04 +05:00
|
|
|
emoji: name
|
2022-01-05 00:24:57 +05:00
|
|
|
}));
|
2022-01-04 02:18:28 +05:00
|
|
|
}
|
2022-01-13 00:26:23 +05:00
|
|
|
}
|
2022-01-04 02:18:28 +05:00
|
|
|
|
|
|
|
module.exports = Addemoji;
|