mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Merge pull request #2351 from Wolfsblvt/rename-char-command
/rename-char slash command
This commit is contained in:
@ -23,6 +23,7 @@ import {
|
||||
name2,
|
||||
reloadCurrentChat,
|
||||
removeMacros,
|
||||
renameCharacter,
|
||||
saveChatConditional,
|
||||
sendMessageAsUser,
|
||||
sendSystemMessage,
|
||||
@ -323,6 +324,29 @@ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||
helpString: 'Opens up a chat with the character or group by its name',
|
||||
aliases: ['char'],
|
||||
}));
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||
name: 'rename-char',
|
||||
/** @param {{silent: string, chats: string}} options @param {string} name */
|
||||
callback: async ({ silent = 'true', chats = null }, name) => {
|
||||
const renamed = await renameCharacter(name, { silent: isTrueBoolean(silent), renameChats: chats !== null ? isTrueBoolean(chats) : null });
|
||||
return String(renamed);
|
||||
},
|
||||
returns: 'true/false - Whether the rename was successful',
|
||||
namedArgumentList: [
|
||||
new SlashCommandNamedArgument(
|
||||
'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(
|
||||
'chats', 'Rename char in all previous chats', [ARGUMENT_TYPE.BOOLEAN], false, false, '<null>',
|
||||
),
|
||||
],
|
||||
unnamedArgumentList: [
|
||||
new SlashCommandArgument(
|
||||
'new char name', [ARGUMENT_TYPE.STRING], true,
|
||||
),
|
||||
],
|
||||
helpString: 'Renames the current character.',
|
||||
}));
|
||||
SlashCommandParser.addCommandObject(SlashCommand.fromProps({
|
||||
name: 'sysgen',
|
||||
callback: generateSystemMessage,
|
||||
|
Reference in New Issue
Block a user