Files
xiao/commands/random/wouldyourather.js
T
2017-05-08 13:46:36 +00:00

34 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}`);
}
}
};