diff --git a/src/commands/roll.js b/src/commands/roll.js index 9166190..38b631b 100644 --- a/src/commands/roll.js +++ b/src/commands/roll.js @@ -1,18 +1,19 @@ // eslint-disable-next-line no-unused-vars module.exports = async (message, args, db) => { - if (!args.length == 3) { - message.reply('Du hast die Würfel nicht korrekt angegeben.'); - } + let command = args.join('') + let regex = /\s?[DdWw]\s?/; + let command = command.split(regex); - else if(!isNaN(args[0]) && !isNaN(args[2]) && args[0] > 0 && args[2] > 0) { - const roll = []; - for (let i = 0; i < args[0]; i++) { - const a = Math.floor(Math.random() * args[2]) + 1; - roll.push(a); + if (command.length == 2){ + let numberOfDice = command[0]; + let diceValues = command[1]; + let roll = []; + for (let i = 0; i W ')} }; \ No newline at end of file