roll: actually fix 0 and no args/nan
This commit is contained in:
parent
16ea0aaef0
commit
33065b8aa6
1 changed files with 3 additions and 3 deletions
|
@ -6,14 +6,14 @@ roll.helpText = "Roll a dice";
|
|||
roll.usage = "<sides>";
|
||||
roll.addAlias("img");
|
||||
roll.callback = function (msg, line) {
|
||||
if (line == null || line == "") line = 6;
|
||||
line = Number(line);
|
||||
if (Number.isNaN(line)) line = 6;
|
||||
if (line < 0) line = Math.abs(line);
|
||||
|
||||
if (line == 0) return ":hole:";
|
||||
if (line == 1) return ":one:";
|
||||
|
||||
if (line == null || line == "" || Number.isNaN(line)) line = 6;
|
||||
if (line < 0) line = Math.abs(line);
|
||||
|
||||
const res = Math.floor(Math.random() * line);
|
||||
|
||||
if (line == 2) {
|
||||
|
|
Loading…
Reference in a new issue