Fix type errors in variables.js

This commit is contained in:
Cohee
2025-07-25 22:37:09 +03:00
parent 8948d9773e
commit c094e5d8ef
+2 -2
View File
@@ -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++) {