mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-16 15:57:54 +02:00
random.cat API
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
const { Command } = require('discord.js-commando');
|
||||
const cats = require('./cats');
|
||||
const request = require('superagent');
|
||||
|
||||
module.exports = class CatCommand extends Command {
|
||||
constructor(client) {
|
||||
@@ -14,11 +14,16 @@ module.exports = class CatCommand extends Command {
|
||||
});
|
||||
}
|
||||
|
||||
run(message) {
|
||||
async run(message) {
|
||||
if (message.channel.type !== 'dm')
|
||||
if (!message.channel.permissionsFor(this.client.user).has('ATTACH_FILES'))
|
||||
return message.say('This Command requires the `Attach Files` Permission.');
|
||||
const cat = cats[Math.floor(Math.random() * cats.length)];
|
||||
return message.channel.send({files: [cat]});
|
||||
try {
|
||||
const { body } = await request
|
||||
.get('http://random.cat/meow');
|
||||
return message.channel.send({files: [body.file]});
|
||||
} catch (err) {
|
||||
return message.say('An Unknown Error Occurred.');
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
@@ -1,22 +0,0 @@
|
||||
[
|
||||
"https://i.imgur.com/BYIsrcy.jpg",
|
||||
"https://i.imgur.com/4huevNv.jpg",
|
||||
"https://i.imgur.com/I52wMLL.jpg",
|
||||
"https://i.imgur.com/51xZFRg.jpg",
|
||||
"https://i.imgur.com/4CfKp58.jpg",
|
||||
"https://i.imgur.com/vNU99Ix.jpg",
|
||||
"https://i.imgur.com/Fvru0x5.jpg",
|
||||
"https://i.imgur.com/pBbf7gu.jpg",
|
||||
"https://i.imgur.com/A7UjE8I.jpg",
|
||||
"https://i.imgur.com/qfGSFCa.jpg",
|
||||
"https://i.imgur.com/e3isfmE.jpg",
|
||||
"https://i.imgur.com/kEDeoUT.jpg",
|
||||
"https://i.imgur.com/pta9FML.jpg",
|
||||
"https://i.imgur.com/HKhVeiV.jpg",
|
||||
"https://i.imgur.com/1qpQesN.jpg",
|
||||
"https://i.imgur.com/lEeoU0b.jpg",
|
||||
"https://i.imgur.com/VINBpuw.jpg",
|
||||
"https://i.imgur.com/1dp1koX.jpg",
|
||||
"https://i.imgur.com/N586OTx.jpg",
|
||||
"https://i.imgur.com/0T1ykQI.jpg"
|
||||
]
|
||||
Reference in New Issue
Block a user