Advice slip Command

This commit is contained in:
Daniel Odendahl Jr
2018-05-02 17:41:14 +00:00
parent f507ede66a
commit 982549d942
3 changed files with 26 additions and 2 deletions
+2 -1
View File
@@ -15,7 +15,7 @@ You can invite the bot to your server using
Be sure to also join the [home server](https://discord.gg/sbMe32W) for
information and support.
## Commands (307)
## Commands (308)
### Utility:
* **prefix**: Shows or sets the command prefix.
@@ -54,6 +54,7 @@ information and support.
### Random Response:
* **8-ball**: Asks your question to the Magic 8 Ball.
* **advice-slip**: Responds with a random bit of advice.
* **cat-fact**: Responds with a random cat fact.
* **cat**: Responds with a random cat image.
* **charlie-charlie-challenge**: Asks your question to Charlie.
+23
View File
@@ -0,0 +1,23 @@
const { Command } = require('discord.js-commando');
const snekfetch = require('snekfetch');
module.exports = class AdviceSlipCommand extends Command {
constructor(client) {
super(client, {
name: 'advice-slip',
aliases: ['advice'],
group: 'random',
memberName: 'advice-slip',
description: 'Responds with a random bit of advice.'
});
}
async run(msg) {
try {
const { raw } = await snekfetch.get('http://api.adviceslip.com/advice');
return msg.say(JSON.parse(raw.toString()).slip.advice);
} catch (err) {
return msg.reply(`Oh no, an error occurred: \`${err.message}\`. Try again later!`);
}
}
};
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "xiao",
"version": "75.0.4",
"version": "75.1.0",
"description": "Your personal server companion.",
"main": "Xiao.js",
"scripts": {