最近,我正在创建一个掷骰子的Discord机器人。但是,为了使它起作用,我必须对每个骰子进行编程。像这样:
const commando = require('discord.js-commando');
class TwentyDiceRollCommand extends commando.Command {
constructor(client) {
super(client, {
name: 'rolltwenty',
group: 'random',
memberName: 'rolltwenty',
description: 'Rolls a twenty die'
});
}
async run(message, args){
var rollTwenty = Math.floor(Math.random() * 20) + 1;
message.reply(' você tirou um ' + rollTwenty);
}
}
module.exports = TwentyDiceRollCommand;
要使它不进行预编程就可以做什么?像,掷D978骰子。