roll: move 0 and 1 checks above everything

This commit is contained in:
Cynthia Foxwell 2024-08-18 15:11:14 -06:00
parent 1f5971d52d
commit 16ea0aaef0

View file

@ -7,12 +7,13 @@ roll.usage = "<sides>";
roll.addAlias("img");
roll.callback = function (msg, line) {
line = Number(line);
if (line == null || line == "" || 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) {