roll: lua brained

This commit is contained in:
Cynthia Foxwell 2025-09-21 11:50:48 -06:00
parent 7e735b93e5
commit fdff86e318
Signed by: Cynosphere
SSH key fingerprint: SHA256:H3SM8ufP/uxqLwKSH7xY89TDnbR9uOHzjLoBr0tlajk

View file

@ -11,11 +11,11 @@ roll.callback = function (msg, line, [sides], {advantage, disadvantage}) {
let num = 1;
if (sides.indexOf("d") > -1) {
const split = sides.split("d");
if (split[2] != null) {
num = split[1];
sides = split[2];
} else {
if (split[1] != null) {
num = split[0];
sides = split[1];
} else {
sides = split[0];
}
}
num = Number(num);
@ -71,7 +71,7 @@ const rollInteraction = new InteractionCommand("roll");
rollInteraction.helpText = "Roll a dice";
rollInteraction.options.sides = {
name: "sides",
type: ApplicationCommandOptionTypes.NUMBER,
type: ApplicationCommandOptionTypes.STRING,
description: "How many sides to pick from (use #d# to roll multiple dice)",
required: false,
default: 6,