Files
xiao/commands/random/wouldyourather.js
T
Daniel Odendahl Jr 52e299b1b4 Auto-Aliases
2017-05-07 17:34:59 +00:00

36 lines
1.2 KiB
JavaScript

const { Command } = require('discord.js-commando');
const { RichEmbed } = require('discord.js');
const request = require('superagent');
module.exports = class WouldYouRatherCommand extends Command {
constructor(client) {
super(client, {
name: 'would-you-rather',
aliases: [
'wyrather'
],
group: 'random',
memberName: 'would-you-rather',
description: 'Gets a random would you rather question.'
});
}
async run(msg) {
if(msg.channel.type !== 'dm')
if(!msg.channel.permissionsFor(this.client.user).has('EMBED_LINKS'))
return msg.say('This Command requires the `Embed Links` Permission.');
try {
const { body } = await request
.get('http://www.rrrather.com/botapi');
const embed = new RichEmbed()
.setTitle(`${body.title}...`)
.setURL(body.link)
.setColor(0x9797FF)
.setDescription(`${body.choicea} OR ${body.choiceb}?`);
return msg.embed(embed);
} catch(err) {
return msg.say(`An Error Occurred: ${err}`);
}
}
};