Defaulting negative dice inputs.
This commit is contained in:
parent
a0ab0302f3
commit
2c2e7ee532
|
@ -15,13 +15,8 @@ function onCommand(args, context) {
|
|||
return;
|
||||
}
|
||||
|
||||
const rolls = Number(args[0]) || 1;
|
||||
const faces = Number(args[1]) || 6;
|
||||
|
||||
if (rolls < 1 || faces < 1) {
|
||||
context.sendMessage('The dice must exist in the physical universe.', context.room.id);
|
||||
return;
|
||||
}
|
||||
const rolls = Math.max(Number(args[0]) || 1, 1);
|
||||
const faces = Math.max(Number(args[1]) || 6, 1);
|
||||
|
||||
if (rolls > config.dice.maxRolls) {
|
||||
context.sendMessage(`You can only roll ${config.dice.maxRolls} dice at one time`, context.room.id);
|
||||
|
|
Loading…
Reference in New Issue