summaryrefslogtreecommitdiff
path: root/src/commands/animals/cat.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/commands/animals/cat.ts')
-rw-r--r--src/commands/animals/cat.ts38
1 files changed, 38 insertions, 0 deletions
diff --git a/src/commands/animals/cat.ts b/src/commands/animals/cat.ts
new file mode 100644
index 0000000..2530830
--- /dev/null
+++ b/src/commands/animals/cat.ts
@@ -0,0 +1,38 @@
+import { Command, CommandoMessage } from 'discord.js-commando';
+import emoji from 'emoji-random'
+import { MessageEmbed } from 'discord.js';
+import axios from 'axios';
+
+module.exports = class CatAnimals extends Command {
+ constructor(client) {
+ super(client, {
+ name: 'cat',
+ aliases: [
+ 'randomcat',
+ 'random-cat'
+ ],
+ group: 'animals',
+ memberName: 'cat',
+ description: 'Gives you a random cat.',
+ examples: ['uwu!cat'],
+ throttling: {
+ usages: 5,
+ duration: 30
+ },
+ userPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY'],
+ clientPermissions: ['SEND_MESSAGES', 'READ_MESSAGE_HISTORY']
+ });
+ }
+ async run(msg: CommandoMessage) {
+ try {
+ let emb = new MessageEmbed()
+ .setAuthor('random.cat', 'https://i.imgur.com/Ik0Gf0r.png', 'https://random.cat')
+ .setColor(0xFFCC4D)
+ .setImage(await (await axios.get('https://aws.random.cat/meow')).data.file)
+ msg.say(emb)
+ } catch (err) {
+ console.log(err)
+ msg.reply('Woops, there was an error with the (http://random.cat) API. ' + emoji.random())
+ }
+ }
+}; \ No newline at end of file