mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-27 06:37:32 +02:00
Merge random animal and animal fact commands
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
const Command = require('../../structures/Command');
|
||||
const request = require('node-superfetch');
|
||||
const facts = require('../../assets/json/dog-fact');
|
||||
|
||||
module.exports = class DogCommand extends Command {
|
||||
constructor(client) {
|
||||
super(client, {
|
||||
name: 'dog',
|
||||
aliases: ['puppy'],
|
||||
aliases: ['puppy', 'dog-fact', 'puppy-fact', 'inu', 'inu-fact'],
|
||||
group: 'random-img',
|
||||
memberName: 'dog',
|
||||
description: 'Responds with a random dog image.',
|
||||
description: 'Responds with a random dog image and fact.',
|
||||
clientPermissions: ['ATTACH_FILES'],
|
||||
credit: [
|
||||
{
|
||||
@@ -24,7 +25,7 @@ module.exports = class DogCommand extends Command {
|
||||
async run(msg) {
|
||||
try {
|
||||
const { body } = await request.get('https://dog.ceo/api/breeds/image/random');
|
||||
return msg.say({ files: [body.message] });
|
||||
return msg.say(facts[Math.floor(Math.random() * facts.length)], { files: [body.message] });
|
||||
} catch (err) {
|
||||
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user