diff --git a/bot/commands/Fun/garfield.js b/bot/commands/Fun/garfield.js index 02ee8b6..e842921 100644 --- a/bot/commands/Fun/garfield.js +++ b/bot/commands/Fun/garfield.js @@ -7,7 +7,8 @@ module.exports = class Garfield extends Command { super (name, category); this.name = name, this.description = 'John I require lasagna', - this.category = category; + this.category = category, + this.cooldown = 20000, this.options = [ { type: 1, @@ -71,10 +72,10 @@ module.exports = class Garfield extends Command { .setColor(bot.user.hexAccentColor ?? bot.displayHexColor) .setImage(json.data.image.src); interaction.editReply({ embeds: [embed] }); - }).catch(err => { + }) + .catch(err => { client.logger.error('GARFIELD_COMMAND_ERROR', `API err or err replying: ${err}`); return interaction.editReply(`${client.config.emojis.botError} An API error occurred, sorry! I've reported this to my developers.`); }); - } }; \ No newline at end of file diff --git a/bot/commands/Fun/inspire.js b/bot/commands/Fun/inspire.js new file mode 100644 index 0000000..1e37cf4 --- /dev/null +++ b/bot/commands/Fun/inspire.js @@ -0,0 +1,23 @@ +const Command = require('../../base/Command.js'); +const fetch = require('node-fetch'); + +module.exports = class Inspire extends Command { + constructor (name, category) { + super (name, category); + this.name = name, + this.description = 'Generates a (likely terrible) inspirational quote.', + this.category = category, + this.cooldown = 10000; + } + + async run (client, interaction, data) { //eslint-disable-line no-unused-vars + interaction.deferReply(); + fetch('http://inspirobot.me/api?generate=true', { headers: { 'User-Agent': client.config.userAgent }}) + .then(res => res.text()) + .then(body => interaction.editReply(body)) + .catch(err => { + client.logger.error('INSPIRE_COMMAND_ERROR', `API err or err replying: ${err}`); + return interaction.editReply(`${client.config.emojis.botError} An API error occurred, sorry! I've reported this to my developers.`); + }); + } +}; \ No newline at end of file