Files
xiao/commands/random-res/quote.js
T
2017-07-25 21:31:14 +00:00

33 lines
951 B
JavaScript

const Command = require('../../structures/Command');
const { MessageEmbed } = require('discord.js');
const snekfetch = require('snekfetch');
module.exports = class QuoteCommand extends Command {
constructor(client) {
super(client, {
name: 'quote',
group: 'random-res',
memberName: 'quote',
description: 'Responds with a random quote.',
clientPermissions: ['EMBED_LINKS']
});
}
async run(msg) {
const { body } = await snekfetch
.get('https://api.forismatic.com/api/1.0/')
.query({
method: 'getQuote',
lang: 'en',
format: 'json'
});
const embed = new MessageEmbed()
.setColor(0x9797FF)
.setURL(body.quoteLink)
.setAuthor(body.quoteAuthor)
.setDescription(body.quoteText);
return msg.embed(embed);
}
};