forked from Supositware/Haha-Yes
You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
const { Command } = require('discord.js-commando');
|
|
const Discord = require('discord.js');
|
|
const fetch = require('node-fetch')
|
|
const SelfReloadJSON = require('self-reload-json');
|
|
const blacklist = require('../../blacklist');
|
|
|
|
module.exports = class AdviceCommand extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: 'advice',
|
|
group: 'fun',
|
|
memberName: 'advice',
|
|
description: `Show some random advice`,
|
|
});
|
|
}
|
|
|
|
async run(message) {
|
|
let blacklistJson = new SelfReloadJSON('json/blacklist.json');
|
|
if(blacklistJson[message.author.id])
|
|
return blacklist(blacklistJson[message.author.id] , 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);
|
|
});
|
|
}}; |