mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2024-12-11 00:46:38 +01:00
Deprecate old /sendas syntax.
"name" arg is now required, but defaults to {{char}} for compatibility
This commit is contained in:
parent
49074effce
commit
e08a21ebe7
@ -20,6 +20,7 @@ import {
|
||||
is_send_press,
|
||||
main_api,
|
||||
name1,
|
||||
name2,
|
||||
reloadCurrentChat,
|
||||
removeMacros,
|
||||
retriggerFirstMessageOnEmptyChat,
|
||||
@ -1404,14 +1405,12 @@ export async function sendMessageAs(args, text) {
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
const parts = text.split('\n');
|
||||
if (parts.length <= 1) {
|
||||
toastr.warning('Both character name and message are required. Separate them with a new line.');
|
||||
return;
|
||||
const namelessWarningKey = 'sendAsNamelessWarningShown';
|
||||
if (localStorage.getItem(namelessWarningKey) !== 'true') {
|
||||
toastr.warning('To avoid confusion, please use /sendas name="Character Name"', 'Name defaulted to {{char}}', { timeOut: 10000 });
|
||||
localStorage.setItem(namelessWarningKey, 'true');
|
||||
}
|
||||
|
||||
name = parts.shift().trim();
|
||||
mesText = parts.join('\n').trim();
|
||||
name = name2;
|
||||
}
|
||||
|
||||
// Requires a regex check after the slash command is pushed to output
|
||||
|
Loading…
Reference in New Issue
Block a user