This repository has been archived on 2022-10-14. You can view files and clone it, but cannot push or open issues or pull requests.
melonybot/commands/responders/gold.js
2020-04-26 15:35:00 -07:00

21 lines
619 B
JavaScript

module.exports = class extends Akairo.Command {
constructor() {
super("gold", {
regex: /^gold$/i,
description: "Bot reacts with reddit gold",
category: "responders"
})
}
async exec(message, args) {
let emoji = message.guild.emojis.cache.find(x => x.name == "gold")
if (!emoji) {
try {
emoji = await message.guild.emojis.create("resources/gold_512.png", "gold")
} catch (error) {
console.error(`could not create gold emoji: ${error.message}`)
}
}
if (emoji) await message.react(emoji)
else await message.channel.send(new Discord.MessageAttachment("resources/gold_48.png"))
}
}