Files
xiao/commands/response/coin.js
T
2017-04-20 22:13:27 +00:00

27 lines
806 B
JavaScript

const { Command } = require('discord.js-commando');
const sides = ['heads', 'tails'];
module.exports = class CoinFlipCommand extends Command {
constructor(client) {
super(client, {
name: 'coin',
aliases: [
'coinflip',
'flip'
],
group: 'response',
memberName: 'coin',
description: 'Flips a coin. (x;coin)',
examples: ['x;coin']
});
}
run(message) {
if (message.channel.type !== 'dm') {
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
}
const coin = sides[Math.floor(Math.random() * sides.length)];
return message.say(`It landed on ${coin}!`);
}
};