Fix piping not using array for empty unnamed args

- Lenny said if `splitUnnamedArgument` is enabled, the callback should always receive an array.
- It is intended that if no value was provided, it'll get an array with an empty string. Because.. if no argument was provided for a non-split arg, it'll receive an empty string too.
This commit is contained in:
Wolfsblvt 2024-09-30 20:22:44 +02:00
parent dedb96ec8d
commit 140aeb2bb7
1 changed files with 8 additions and 0 deletions

View File

@ -508,6 +508,14 @@ export class SlashCommandClosure {
return v;
});
}
value ??= '';
// Make sure that if unnamed args are split, it should always return an array
if (executor.command.splitUnnamedArgument && !Array.isArray(value)) {
value = [value];
}
return value;
}