Created
October 18, 2018 13:18
-
-
Save CallumDenby/45147b62d281c39067595c1c1202220a to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const { Client } = require('discord.js'); | |
const Discord = new Client(); | |
const commands = { | |
steal: (emoji, name, message) => { | |
const emojiId = emoji.match(/([0-9]+)/)[0]; | |
if (!emojiId) return message.reply('Emoji ID not found'); | |
message.guild.createEmoji(`https://cdn.discordapp.com/emojis/${emojiId}`, name) | |
.then((newEmoji) => { | |
message.react(newEmoji); | |
}) | |
.catch((err) => { | |
console.error(err); | |
message.react('👎'); | |
}) | |
} | |
} | |
Discord.on('message', (message) => { | |
if (!message.content.startsWith(':')) return; | |
const content = message.content.substring(1); | |
const [command, ...args] = content.split(' '); | |
if (command in commands) commands[command](...args, message); | |
else message.reply('Command not found'); | |
}) | |
Discord.on('ready', () => { | |
console.log(`Logged in as ${Discord.user.username}`); | |
}) | |
Discord.login('BOT_TOKEN'); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment