FIX: Properly handle text responses when character name is not provided in sendas cmd

This commit is contained in:
joenunezb 2024-07-27 21:29:37 -07:00
parent d46fd9d174
commit 211c671cb6
1 changed files with 6 additions and 1 deletions

View File

@ -2847,7 +2847,6 @@ export async function sendMessageAs(args, text) {
if (args.name) { if (args.name) {
name = args.name.trim(); name = args.name.trim();
mesText = text.trim();
if (!name && !text) { if (!name && !text) {
toastr.warning('You must specify a name and text to send as'); toastr.warning('You must specify a name and text to send as');
@ -2860,7 +2859,13 @@ export async function sendMessageAs(args, text) {
localStorage.setItem(namelessWarningKey, 'true'); localStorage.setItem(namelessWarningKey, 'true');
} }
name = name2; 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 // Requires a regex check after the slash command is pushed to output
mesText = getRegexedString(mesText, regex_placement.SLASH_COMMAND, { characterOverride: name }); mesText = getRegexedString(mesText, regex_placement.SLASH_COMMAND, { characterOverride: name });