From 20fa23c016f3a1d84f0f3026ecb2c558932b2570 Mon Sep 17 00:00:00 2001 From: Daniel Odendahl Jr Date: Sat, 8 Sep 2018 01:59:52 +0000 Subject: [PATCH] Duck Command --- README.md | 3 ++- commands/random/duck.js | 24 ++++++++++++++++++++++++ package.json | 2 +- 3 files changed, 27 insertions(+), 2 deletions(-) create mode 100644 commands/random/duck.js diff --git a/README.md b/README.md index 4a56e295..a37ca75d 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 (302) +## Commands (303) ### Utility: * **eval:** Executes JavaScript code. @@ -55,6 +55,7 @@ on the [home server](https://discord.gg/sbMe32W). * **dog-fact:** Responds with a random dog fact. * **dog:** Responds with a random dog image. * **draw-cards:** Draws a random hand of playing cards. +* **duck**: Responds with a random duck image. * **fact-core:** Responds with a random Fact Core quote. * **fact:** Responds with a random fact. * **fidget:** Responds with a random image of Fidget. diff --git a/commands/random/duck.js b/commands/random/duck.js new file mode 100644 index 00000000..62690d25 --- /dev/null +++ b/commands/random/duck.js @@ -0,0 +1,24 @@ +const Command = require('../../structures/Command'); +const request = require('node-superfetch'); + +module.exports = class DuckCommand extends Command { + constructor(client) { + super(client, { + name: 'duck', + aliases: ['quack', 'ducky'], + group: 'random', + memberName: 'duck', + description: 'Responds with a random duck image.', + clientPermissions: ['ATTACH_FILES'] + }); + } + + async run(msg) { + try { + const { body } = await request.get('https://api.random-d.uk/random'); + return msg.say({ files: [body.url] }); + } catch (err) { + return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`); + } + } +}; diff --git a/package.json b/package.json index 01127020..6f03e567 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "xiao", - "version": "90.4.0", + "version": "90.5.0", "description": "Your personal server companion.", "main": "Xiao.js", "scripts": {