Merge random animal and animal fact commands

This commit is contained in:
Dragon Fire
2021-01-14 19:31:08 -05:00
parent e43f0b73d4
commit 473ce2b9d9
8 changed files with 19 additions and 71 deletions
+4 -7
View File
@@ -260,7 +260,7 @@ in the appropriate channel's topic to use it.
## Commands
Total: 576
Total: 573
### Utility:
@@ -320,14 +320,11 @@ Total: 576
* **advice:** Responds with a random bit of advice.
* **axis-cult:** Responds with a teaching of the Axis Cult.
* **boredom:** Responds with a random activity to try when you're bored.
* **bunny-fact:** Responds with a random bunny fact.
* **cat-fact:** Responds with a random cat fact.
* **charlie-charlie:** Asks your question to Charlie.
* **choose:** Chooses between options you provide.
* **chuck-norris:** Responds with a random Chuck Norris joke.
* **coin:** Flips a coin.
* **compliment:** Compliments a user.
* **dog-fact:** Responds with a random dog fact.
* **draw-cards:** Draws a random hand of playing cards.
* **fact-core:** Responds with a random Fact Core quote.
* **fact:** Responds with a random fact.
@@ -377,9 +374,9 @@ Total: 576
* **ai-waifu:** Responds with a randomly generated waifu.
* **awwnime:** Responds with cute random anime art.
* **bird:** Responds with a random image of a bird.
* **bunny:** Responds with a random image of a bunny.
* **cat:** Responds with a random cat image.
* **dog:** Responds with a random dog image.
* **bunny:** Responds with a random bunny image and fact..
* **cat:** Responds with a random cat image and fact.
* **dog:** Responds with a random dog image and fact.
* **duck:** Responds with a random duck image.
* **fidget:** Responds with a random image of Fidget.
* **food:** Responds with a randomly generated food.
+6 -3
View File
@@ -1,14 +1,15 @@
const Command = require('../../structures/Command');
const request = require('node-superfetch');
const facts = require('../../assets/json/bunny-fact');
module.exports = class BunnyCommand extends Command {
constructor(client) {
super(client, {
name: 'bunny',
aliases: ['bun', 'rabbit'],
aliases: ['bun', 'rabbit', 'bunny-fact', 'bun-fact', 'rabbit-fact'],
group: 'random-img',
memberName: 'bunny',
description: 'Responds with a random image of a bunny.',
description: 'Responds with a random bunny image and fact.',
clientPermissions: ['ATTACH_FILES'],
credit: [
{
@@ -35,7 +36,9 @@ module.exports = class BunnyCommand extends Command {
} else {
fileToSend = gif.body;
}
return msg.say({ files: [{ attachment: fileToSend, name: `${body.id}.${fileType}` }] });
return msg.say(facts[Math.floor(Math.random() * facts.length)], {
files: [{ attachment: fileToSend, name: `${body.id}.${fileType}` }]
});
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
+4 -3
View File
@@ -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!`);
}
+4 -3
View File
@@ -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!`);
}
-18
View File
@@ -1,18 +0,0 @@
const Command = require('../../structures/Command');
const facts = require('../../assets/json/bunny-fact');
module.exports = class BunnyFactCommand extends Command {
constructor(client) {
super(client, {
name: 'bunny-fact',
aliases: ['bun-fact', 'rabbit-fact'],
group: 'random-res',
memberName: 'bunny-fact',
description: 'Responds with a random bunny fact.'
});
}
run(msg) {
return msg.say(facts[Math.floor(Math.random() * facts.length)]);
}
};
-18
View File
@@ -1,18 +0,0 @@
const Command = require('../../structures/Command');
const facts = require('../../assets/json/cat-fact');
module.exports = class CatFactCommand extends Command {
constructor(client) {
super(client, {
name: 'cat-fact',
aliases: ['neko-fact', 'kitty-fact'],
group: 'random-res',
memberName: 'cat-fact',
description: 'Responds with a random cat fact.'
});
}
run(msg) {
return msg.say(facts[Math.floor(Math.random() * facts.length)]);
}
};
-18
View File
@@ -1,18 +0,0 @@
const Command = require('../../structures/Command');
const facts = require('../../assets/json/dog-fact');
module.exports = class DogFactCommand extends Command {
constructor(client) {
super(client, {
name: 'dog-fact',
aliases: ['puppy-fact'],
group: 'random-res',
memberName: 'dog-fact',
description: 'Responds with a random dog fact.'
});
}
run(msg) {
return msg.say(facts[Math.floor(Math.random() * facts.length)]);
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "125.0.1",
"version": "126.0.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {