const { Command } = require('discord.js-commando');
const Discord = require('discord.js');
const fetch = require('node-fetch')
const blacklist = require('../../json/blacklist.json')

module.exports = class AdviceCommand extends Command {
    constructor(client) {
        super(client, {
            name: 'advice',
            group: 'fun',
            memberName: 'advice',
            description: `Show some random advice`,
        });
    }

    async run(message) {
        if(blacklist[message.author.id])
        return message.channel.send("You are blacklisted")
        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);
          });
}};