Fix legacy {{authorsNote}}

bc660b8b9113ad0bf295cdf578d95e81a810f4e7

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

1 files changed, +18 -1Showing whitespace changes
public/scripts/authors-note.js+18 -1
@@ -20,6 +20,8 @@ import { ARGUMENT_TYPE, SlashCommandArgument } from './slash-commands/SlashComma
2020export { MODULE_NAME as NOTE_MODULE_NAME };
2121import { t } from './i18n.js';
2222import { macros, MacroCategory } from './macros/macro-system.js';
23+import { MacrosParser } from './macros.js';
24+import { power_user } from './power-user.js';
2325
2426const MODULE_NAME = '2_floating_prompt'; // <= Deliberate, for sorting lower than memory
2527
@@ -585,6 +587,7 @@ export function initAuthorsNote() {
585587}
586588
587589function registerAuthorsNoteMacros() {
590+ if (power_user.experimental_macro_engine) {
588591 macros.register('authorsNote', {
589592 category: MacroCategory.PROMPTS,
590593 description: t`The contents of the Author's Note`,
@@ -600,5 +603,19 @@ function registerAuthorsNoteMacros() {
600603 description: t`The contents of the Default Author's Note`,
601604 handler: () => extension_settings.note.default ?? '',
602605 });
606+ } else {
607+ // TODO: Remove this when the experimental macro engine is replacing the old macro engine
608+ MacrosParser.registerMacro('authorsNote',
609+ () => chat_metadata[metadata_keys.prompt] ?? '',
610+ t`The contents of the Author's Note`,
611+ );
612+ MacrosParser.registerMacro('charAuthorsNote',
613+ () => this_chid !== undefined ? (extension_settings.note.chara.find((e) => e.name === getCharaFilename())?.prompt ?? '') : '',
614+ t`The contents of the Character Author's Note`,
615+ );
616+ MacrosParser.registerMacro('defaultAuthorsNote',
617+ () => extension_settings.note.default ?? '',
618+ t`The contents of the Default Author's Note`,
619+ );
620+ }
603621}
604-