From 98dfd25ee7dce18ea58e6c266c48c2cb15410e73 Mon Sep 17 00:00:00 2001 From: LenAnderson Date: Tue, 9 Jul 2024 08:21:57 -0400 Subject: [PATCH] force pipe to stringified JSON if not string or closure --- public/scripts/slash-commands/SlashCommandClosure.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/public/scripts/slash-commands/SlashCommandClosure.js b/public/scripts/slash-commands/SlashCommandClosure.js index 663776acb..e5a9415b8 100644 --- a/public/scripts/slash-commands/SlashCommandClosure.js +++ b/public/scripts/slash-commands/SlashCommandClosure.js @@ -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) ?? ''; } } }