JaBa/TO REWRITE/Administration/stealemoji.js

39 lines
1 KiB
JavaScript
Raw Normal View History

const Command = require("../../base/Command"),
{ Util } = require("discord.js");
class Stealemoji extends Command {
constructor(client) {
super(client, {
name: "stealemoji",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["steale"],
memberPermissions: ["MANAGE_GUILD"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args) {
if (!args.length) return message.error("administration/stealemoji:MISSING_EMOJI");
for (const rawEmoji of args) {
const parsedEmoji = Util.parseEmoji(rawEmoji);
const extension = parsedEmoji.animated ? "gif" : "png";
message.guild.emojis
.create(`https://cdn.discordapp.com/emojis/${parsedEmoji.id}.${extension}`, parsedEmoji.name)
.then(emoji => message.success("administration/stealemoji:SUCCESS", {
emoji: emoji.name
}))
.catch(() => message.error("administration/stealemoji:ERROR", {
emoji: parsedEmoji.name
}));
}
}
}
module.exports = Stealemoji;