mirror of
https://github.com/SillyTavern/SillyTavern.git
synced 2025-06-05 21:59:27 +02:00
Add slash commands for chat styles and continue
This commit is contained in:
@ -1213,6 +1213,13 @@ function addOneMessage(mes, { type = "normal", insertAfter = null, scroll = true
|
|||||||
messageText = mes.extra.display_text;
|
messageText = mes.extra.display_text;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Forbidden black magic
|
||||||
|
// This allows to use "continue" on user messages
|
||||||
|
if (type === 'swipe' && mes.swipe_id === undefined) {
|
||||||
|
mes.swipe_id = 0;
|
||||||
|
mes.swipes = [mes.mes];
|
||||||
|
}
|
||||||
|
|
||||||
if (mes.name === name1) {
|
if (mes.name === name1) {
|
||||||
var characterName = name1; //set to user's name by default
|
var characterName = name1; //set to user's name by default
|
||||||
} else { var characterName = mes.name }
|
} else { var characterName = mes.name }
|
||||||
|
@ -51,7 +51,7 @@ const avatar_styles = {
|
|||||||
RECTANGULAR: 1,
|
RECTANGULAR: 1,
|
||||||
}
|
}
|
||||||
|
|
||||||
const chat_styles = {
|
export const chat_styles = {
|
||||||
DEFAULT: 0,
|
DEFAULT: 0,
|
||||||
BUBBLES: 1,
|
BUBBLES: 1,
|
||||||
DOCUMENT: 2,
|
DOCUMENT: 2,
|
||||||
|
@ -21,7 +21,7 @@ import {
|
|||||||
saveSettings,
|
saveSettings,
|
||||||
} from "../script.js";
|
} from "../script.js";
|
||||||
import { humanizedDateTime } from "./RossAscends-mods.js";
|
import { humanizedDateTime } from "./RossAscends-mods.js";
|
||||||
import { power_user } from "./power-user.js";
|
import { chat_styles, power_user } from "./power-user.js";
|
||||||
export {
|
export {
|
||||||
executeSlashCommands,
|
executeSlashCommands,
|
||||||
registerSlashCommand,
|
registerSlashCommand,
|
||||||
@ -107,11 +107,19 @@ parser.addCommand('sendas', sendMessageAs, [], ` – sends message as a specific
|
|||||||
parser.addCommand('sys', sendNarratorMessage, [], '<span class="monospace">(text)</span> – sends message as a system narrator', false, true);
|
parser.addCommand('sys', sendNarratorMessage, [], '<span class="monospace">(text)</span> – sends message as a system narrator', false, true);
|
||||||
parser.addCommand('sysname', setNarratorName, [], '<span class="monospace">(name)</span> – sets a name for future system narrator messages in this chat (display only). Default: System. Leave empty to reset.', true, true);
|
parser.addCommand('sysname', setNarratorName, [], '<span class="monospace">(name)</span> – sets a name for future system narrator messages in this chat (display only). Default: System. Leave empty to reset.', true, true);
|
||||||
parser.addCommand('comment', sendCommentMessage, [], '<span class="monospace">(text)</span> – adds a note/comment message not part of the chat', false, true);
|
parser.addCommand('comment', sendCommentMessage, [], '<span class="monospace">(text)</span> – adds a note/comment message not part of the chat', false, true);
|
||||||
|
parser.addCommand('single', setStoryModeCallback, ['story'], ' – sets the message style to single document mode without names or avatars visible', true, true);
|
||||||
|
parser.addCommand('bubble', setBubbleModeCallback, ['bubbles'], ' – sets the message style to bubble chat mode', true, true);
|
||||||
|
parser.addCommand('flat', setFlatModeCallback, ['default'], ' – sets the message style to flat chat mode', true, true);
|
||||||
|
parser.addCommand('continue', continueChatCallback, ['cont'], ' – continues the last message in the chat', true, true);
|
||||||
|
|
||||||
const NARRATOR_NAME_KEY = 'narrator_name';
|
const NARRATOR_NAME_KEY = 'narrator_name';
|
||||||
const NARRATOR_NAME_DEFAULT = 'System';
|
const NARRATOR_NAME_DEFAULT = 'System';
|
||||||
const COMMENT_NAME_DEFAULT = 'Note';
|
const COMMENT_NAME_DEFAULT = 'Note';
|
||||||
|
|
||||||
|
function continueChatCallback() {
|
||||||
|
$('#option_continue').trigger('click');
|
||||||
|
}
|
||||||
|
|
||||||
function syncCallback() {
|
function syncCallback() {
|
||||||
$('#sync_name_button').trigger('click');
|
$('#sync_name_button').trigger('click');
|
||||||
}
|
}
|
||||||
@ -120,6 +128,18 @@ function bindCallback() {
|
|||||||
$('#lock_user_name').trigger('click');
|
$('#lock_user_name').trigger('click');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function setStoryModeCallback() {
|
||||||
|
$('#chat_display').val(chat_styles.DOCUMENT).trigger('change');
|
||||||
|
}
|
||||||
|
|
||||||
|
function setBubbleModeCallback() {
|
||||||
|
$('#chat_display').val(chat_styles.BUBBLES).trigger('change');
|
||||||
|
}
|
||||||
|
|
||||||
|
function setFlatModeCallback() {
|
||||||
|
$('#chat_display').val(chat_styles.DEFAULT).trigger('change');
|
||||||
|
}
|
||||||
|
|
||||||
function setNameCallback(_, name) {
|
function setNameCallback(_, name) {
|
||||||
if (!name) {
|
if (!name) {
|
||||||
toastr.warning('you must specify a name to change to')
|
toastr.warning('you must specify a name to change to')
|
||||||
|
Reference in New Issue
Block a user