From d4be43bfd778db8de82da83e949fe78b97b12205 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Wed, 26 Sep 2018 23:39:40 +0000 Subject: [PATCH] Random Bird and Shiba --- README.md | 4 +++- commands/random/bird.js | 24 ++++++++++++++++++++++++ commands/random/shiba.js | 30 ++++++++++++++++++++++++++++++ package.json | 2 +- 4 files changed, 58 insertions(+), 2 deletions(-) create mode 100644 commands/random/bird.js create mode 100644 commands/random/shiba.js diff --git a/README.md b/README.md index c88d1b36..723af145 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,7 @@ Xiao is a Discord bot coded in JavaScript with The bot is no longer available for invite. You can self-host the bot, or use her on the [home server](https://discord.gg/sbMe32W). -## Commands (318) +## Commands (320) ### Utility: * **eval:** Executes JavaScript code. @@ -44,6 +44,7 @@ on the [home server](https://discord.gg/sbMe32W). * **8-ball:** Asks your question to the Magic 8 Ball. * **advice-slip:** Responds with a random bit of advice. +* **bird:** Responds with a random bird image. * **cat-fact:** Responds with a random cat fact. * **cat:** Responds with a random cat image. * **charlie-charlie-challenge:** Asks your question to Charlie. @@ -80,6 +81,7 @@ on the [home server](https://discord.gg/sbMe32W). * **roast:** Roasts a user. * **roll:** Rolls a dice with a maximum value of your choice. * **security-key:** Responds with a random security key. +* **shiba:** Responds with a random image of a Shiba Inu. * **shower-thought:** Responds with a random shower thought, directly from r/Showerthoughts. * **suggest-command:** Suggests a random command for you to try. * **superpower:** Responds with a random superpower. diff --git a/commands/random/bird.js b/commands/random/bird.js new file mode 100644 index 00000000..dd95f67b --- /dev/null +++ b/commands/random/bird.js @@ -0,0 +1,24 @@ +const Command = require('../../structures/Command'); +const request = require('node-superfetch'); + +module.exports = class BirdCommand extends Command { + constructor(client) { + super(client, { + name: 'bird', + aliases: ['birb'], + group: 'random', + memberName: 'bird', + description: 'Responds with a random bird image.', + clientPermissions: ['ATTACH_FILES'] + }); + } + + async run(msg) { + try { + const { body } = await request.get('http://random.birb.pw/tweet.json/'); + return msg.say({ files: [`http://random.birb.pw/img/${body.file}`] }); + } catch (err) { + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } +}; diff --git a/commands/random/shiba.js b/commands/random/shiba.js new file mode 100644 index 00000000..184d2866 --- /dev/null +++ b/commands/random/shiba.js @@ -0,0 +1,30 @@ +const Command = require('../../structures/Command'); +const request = require('node-superfetch'); + +module.exports = class ShibaCommand extends Command { + constructor(client) { + super(client, { + name: 'shiba', + aliases: ['shiba-inu', 'shibe', 'shibe-inu', 'doge'], + group: 'random', + memberName: 'shiba', + description: 'Responds with a random image of a Shiba Inu.', + clientPermissions: ['ATTACH_FILES'] + }); + } + + async run(msg) { + try { + const { body } = await request + .get('https://shibe.online/api/shibes') + .query({ + count: 1, + urls: true, + httpsUrls: true + }); + return msg.say({ files: [body[0]] }); + } catch (err) { + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } +}; diff --git a/package.json b/package.json index 8249b08b..f0115f80 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "91.12.4", + "version": "91.13.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {