From b5eb0cf28cd11416ed1b1a699915cd806c471c80 Mon Sep 17 00:00:00 2001 From: Abheek Dhawan Date: Tue, 13 Apr 2021 11:13:44 -0500 Subject: [PATCH] Add command to add emojis --- bot.js | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/bot.js b/bot.js index 55ed58c..f430890 100644 --- a/bot.js +++ b/bot.js @@ -98,9 +98,25 @@ client.on("message", async message => { aboutBot(message); } else if (message.content.toLowerCase().startsWith(`${prefix}roleinfo`)) { roleInfo(message); + } else if (message.content.toLowerCase().startsWith(`${prefix}addemoji`)) { + addEmoji(message); } }); +async function addEmoji(message) { + if (!message.member.hasPermission('MANAGE_EMOJIS')) { + message.reply(`you don't have the correct permissions to manage emojis!`); + return; + } + let splitMessage = message.content.split(" "); + if (splitMessage.length > 2) { + message.guild.emojis.create(splitMessage[1], splitMessage[2]) + .then(emoji => message.reply(`created new emoji "${emoji.name}"`)) + .catch(error => message.reply(error)); + } else { + message.reply("the format should be `$addEmoji [URL] [name]`"); + } +} async function aboutBot(message) { const uptimeDays = client.uptime / 86400000; let serverCount;