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.
Haha-Yes/commands/general/advice.js

33 lines
789 B
JavaScript

const { Command } = require('discord-akairo');
const fetch = require('node-fetch');
class AdviceCommand extends Command {
5 years ago
constructor() {
super('advice', {
aliases: ['advice'],
category: 'general',
5 years ago
clientPermissions: ['SEND_MESSAGES', 'EMBED_LINKS'],
5 years ago
description: {
content: 'Send some random advices',
usage: '',
examples: ['']
}
5 years ago
});
}
5 years ago
async exec(message) {
fetch('http://api.adviceslip.com/advice').then((response) => {
return response.json();
}).then((response) => {
const adviceEmbed = this.client.util.embed()
.setColor(message.member ? message.member.displayHexColor : 'NAVY')
.setTitle(response.slip.id)
5 years ago
.setDescription(response.slip.advice);
message.reply(adviceEmbed);
5 years ago
});
}
}
module.exports = AdviceCommand;