Add macros for Author's Notes Closes #3716

3c61074d780280e907bac6ae4a78d88fdb1a2081

Cohee <18619528+Cohee1207@users.noreply.github.com>

1 files changed, +5 -0Showing whitespace changes
public/scripts/authors-note.js+5 -0
@@ -17,6 +17,7 @@ import { SlashCommand } from './slash-commands/SlashCommand.js';
17import { ARGUMENT_TYPE, SlashCommandArgument } from './slash-commands/SlashCommandArgument.js';17import { ARGUMENT_TYPE, SlashCommandArgument } from './slash-commands/SlashCommandArgument.js';
18export { MODULE_NAME as NOTE_MODULE_NAME };18export { MODULE_NAME as NOTE_MODULE_NAME };
19import { t } from './i18n.js';19import { t } from './i18n.js';
20import { MacrosParser } from './macros.js';
2021
21const MODULE_NAME = '2_floating_prompt'; // <= Deliberate, for sorting lower than memory22const MODULE_NAME = '2_floating_prompt'; // <= Deliberate, for sorting lower than memory
2223
@@ -576,4 +577,8 @@ export function initAuthorsNote() {
576 `,577 `,
577 }));578 }));
578 eventSource.on(event_types.CHAT_CHANGED, onChatChanged);579 eventSource.on(event_types.CHAT_CHANGED, onChatChanged);
580
581 MacrosParser.registerMacro('authorsNote', () => chat_metadata[metadata_keys.prompt] ?? '', t`The contents of the Author's Note`);
582 MacrosParser.registerMacro('charAuthorsNote', () => this_chid !== undefined ? (extension_settings.note.chara.find((e) => e.name === getCharaFilename())?.prompt ?? '') : '', t`The contents of the Character Author's Note`);
583 MacrosParser.registerMacro('defaultAuthorsNote', () => extension_settings.note.default ?? '', t`The contents of the Default Author's Note`);
579}584}