mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2024-12-12 09:26:33 +01:00
force pipe to stringified JSON if not string or closure
This commit is contained in:
parent
aed6952a37
commit
98dfd25ee7
@ -433,8 +433,11 @@ export class SlashCommandClosure {
|
||||
*/
|
||||
#lintPipe(command) {
|
||||
if (this.scope.pipe === undefined || this.scope.pipe === null) {
|
||||
console.warn(`${command.name} returned undefined or null. Auto-fixing to empty string.`);
|
||||
console.warn(`/${command.name} returned undefined or null. Auto-fixing to empty string.`);
|
||||
this.scope.pipe = '';
|
||||
} else if (!(typeof this.scope.pipe == 'string' || this.scope.pipe instanceof SlashCommandClosure)) {
|
||||
console.warn(`/${command.name} returned illegal type (${typeof this.scope.pipe} - ${this.scope.pipe.constructor?.name ?? ''}). Auto-fixing to stringified JSON.`);
|
||||
this.scope.pipe = JSON.stringify(this.scope.pipe) ?? '';
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user