Fix type errors in variables.js
This commit is contained in:
@@ -321,7 +321,7 @@ async function listVariablesCallback(args) {
|
||||
*/
|
||||
async function whileCallback(args, value) {
|
||||
if (args.guard instanceof SlashCommandClosure) throw new Error('argument \'guard\' cannot be a closure for command /while');
|
||||
const isGuardOff = isFalseBoolean(args.guard);
|
||||
const isGuardOff = isFalseBoolean(args.guard?.toString());
|
||||
const iterations = isGuardOff ? Number.MAX_SAFE_INTEGER : MAX_LOOPS;
|
||||
/**@type {string|SlashCommandClosure} */
|
||||
let command;
|
||||
@@ -380,7 +380,7 @@ async function timesCallback(args, value) {
|
||||
[repeats, ...command] = /**@type {string}*/(value).split(' ');
|
||||
command = command.join(' ');
|
||||
}
|
||||
const isGuardOff = isFalseBoolean(args.guard);
|
||||
const isGuardOff = isFalseBoolean(args.guard?.toString());
|
||||
const iterations = Math.min(Number(repeats), isGuardOff ? Number.MAX_SAFE_INTEGER : MAX_LOOPS);
|
||||
let result;
|
||||
for (let i = 0; i < iterations; i++) {
|
||||
|
||||
Reference in New Issue
Block a user