mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-25 14:21:41 +02:00
Merge random animal and animal fact commands
This commit is contained in:
@@ -1,15 +1,16 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
const facts = require('../../assets/json/cat-fact');
|
||||
const { THECATAPI_KEY } = process.env;
|
||||
|
||||
module.exports = class CatCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'cat',
|
||||
aliases: ['neko', 'kitty', 'meow'],
|
||||
aliases: ['neko', 'kitty', 'meow', 'cat-fact', 'neko-fact', 'kitty-fact', 'meow-fact'],
|
||||
group: 'random-img',
|
||||
memberName: 'cat',
|
||||
description: 'Responds with a random cat image.',
|
||||
description: 'Responds with a random cat image and fact.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
@@ -31,7 +32,7 @@ module.exports = class CatCommand extends Command {
|
||||
mime_types: 'jpg,png'
|
||||
})
|
||||
.set({ 'x-api-key': THECATAPI_KEY });
|
||||
return msg.say({ files: [body[0].url] });
|
||||
return msg.say(facts[Math.floor(Math.random() * facts.length)], { files: [body[0].url] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user