From 211c671cb6586d6bde25256324f33d7aa1b59d18 Mon Sep 17 00:00:00 2001 From: joenunezb Date: Sat, 27 Jul 2024 21:29:37 -0700 Subject: [PATCH] FIX: Properly handle text responses when character name is not provided in sendas cmd --- public/scripts/slash-commands.js | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/public/scripts/slash-commands.js b/public/scripts/slash-commands.js index aef81d246..c12b38040 100644 --- a/public/scripts/slash-commands.js +++ b/public/scripts/slash-commands.js @@ -2847,7 +2847,6 @@ export async function sendMessageAs(args, text) { if (args.name) { name = args.name.trim(); - mesText = text.trim(); if (!name && !text) { toastr.warning('You must specify a name and text to send as'); @@ -2860,8 +2859,14 @@ export async function sendMessageAs(args, text) { localStorage.setItem(namelessWarningKey, 'true'); } name = name2; + if (!text) { + toastr.warning('You must specify text to send as'); + return ''; + } } + mesText = text.trim(); + // Requires a regex check after the slash command is pushed to output mesText = getRegexedString(mesText, regex_placement.SLASH_COMMAND, { characterOverride: name });