mirror of
https://github.com/arthur-pbty/xiao.git
synced 2026-06-03 23:36:43 +02:00
33 lines
1009 B
JavaScript
33 lines
1009 B
JavaScript
const { Command } = require('discord.js-commando');
|
|
|
|
module.exports = class RollCommand extends Command {
|
|
constructor(client) {
|
|
super(client, {
|
|
name: 'roll',
|
|
aliases: [
|
|
'randomnumber',
|
|
'dice'
|
|
],
|
|
group: 'response',
|
|
memberName: 'roll',
|
|
description: 'Rolls a Dice of your choice. (;roll 6)',
|
|
examples: [';roll 6'],
|
|
args: [{
|
|
key: 'number',
|
|
prompt: 'Which number do you want to roll?',
|
|
type: 'integer',
|
|
default: 6
|
|
}]
|
|
});
|
|
}
|
|
|
|
run(message, args) {
|
|
if (message.channel.type !== 'dm') {
|
|
if (!message.channel.permissionsFor(this.client.user).hasPermission(['SEND_MESSAGES', 'READ_MESSAGES'])) return;
|
|
}
|
|
const value = args.number;
|
|
const roll = Math.floor(Math.random() * value) + 1;
|
|
return message.say(`You rolled a ${roll}.`);
|
|
}
|
|
};
|