modified cooldowns and +inspire command

This commit is contained in:
Emily 2022-12-21 16:10:53 +11:00
parent fd29ec5137
commit 2b8c67b16c
2 changed files with 27 additions and 3 deletions

View file

@ -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.`);
});
}
};

View file

@ -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.`);
});
}
};