From d63c54237f462e57bf6aaa138cff7c8ffe18d2ad Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sat, 29 Sep 2018 11:57:51 +0200 Subject: [PATCH] Advice --- commands/fun/advice.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100644 commands/fun/advice.js diff --git a/commands/fun/advice.js b/commands/fun/advice.js new file mode 100644 index 00000000..a8bc8814 --- /dev/null +++ b/commands/fun/advice.js @@ -0,0 +1,26 @@ +const { Command } = require('discord.js-commando'); +const Discord = require('discord.js'); +const fetch = require('node-fetch') +module.exports = class RandoCatCommand extends Command { + constructor(client) { + super(client, { + name: 'advice', + group: 'fun', + memberName: 'advice', + description: `Show some random advice`, + }); + } + + async run(message) { + fetch("http://api.adviceslip.com/advice").then((response) => { + return response.json(); +}).then((response) => { + const adviceEmbed = new Discord.RichEmbed() + .setColor("#ff9900") + .setTitle(response.slip.slip_id) + .setDescription(response.slip.advice) + + + message.say(adviceEmbed); + }); +}}; \ No newline at end of file