mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Small changes to /rename-char
This commit is contained in:
@ -5436,6 +5436,10 @@ export async function renameCharacter(name = null, { silent = false, renameChats
|
|||||||
toastr.warning('No character name provided.', 'Rename Character');
|
toastr.warning('No character name provided.', 'Rename Character');
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
if (this_chid === undefined) {
|
||||||
|
toastr.warning('No character selected.', 'Rename Character');
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
const oldAvatar = characters[this_chid].avatar;
|
const oldAvatar = characters[this_chid].avatar;
|
||||||
const newValue = name || await callPopup('<h3>New name:</h3>', 'input', characters[this_chid].name);
|
const newValue = name || await callPopup('<h3>New name:</h3>', 'input', characters[this_chid].name);
|
||||||
|
@ -328,7 +328,7 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
name: 'rename-char',
|
name: 'rename-char',
|
||||||
/** @param {{silent: string, renameChats: string}} options @param {string} name */
|
/** @param {{silent: string, renameChats: string}} options @param {string} name */
|
||||||
callback: async ({ silent = 'true', renameChats = null }, name) => {
|
callback: async ({ silent = 'true', renameChats = null }, name) => {
|
||||||
const renamed = await renameCharacter(name, { silent: silent === 'true', renameChats: renameChats !== null ? renameChats === 'true' : null });
|
const renamed = await renameCharacter(name, { silent: isTrueBoolean(silent), renameChats: renameChats !== null ? isTrueBoolean(renameChats) : null });
|
||||||
return String(renamed);
|
return String(renamed);
|
||||||
},
|
},
|
||||||
returns: 'true/false - Whether the rename was successful',
|
returns: 'true/false - Whether the rename was successful',
|
||||||
@ -337,7 +337,7 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
|||||||
'silent', 'Hide any blocking popups. (if false, the name is optional. If not supplied, a popup asking for it will appear)', [ARGUMENT_TYPE.BOOLEAN], false, false, 'true'
|
'silent', 'Hide any blocking popups. (if false, the name is optional. If not supplied, a popup asking for it will appear)', [ARGUMENT_TYPE.BOOLEAN], false, false, 'true'
|
||||||
),
|
),
|
||||||
new SlashCommandNamedArgument(
|
new SlashCommandNamedArgument(
|
||||||
'renameChats', 'Rename char in all previous chats', [ARGUMENT_TYPE.BOOLEAN], false, false, '<null>'
|
'chats', 'Rename char in all previous chats', [ARGUMENT_TYPE.BOOLEAN], false, false, '<null>'
|
||||||
),
|
),
|
||||||
],
|
],
|
||||||
unnamedArgumentList: [
|
unnamedArgumentList: [
|
||||||
|
Reference in New Issue
Block a user