Fix legacy {{authorsNote}}
| @@ -20,6 +20,8 @@ import { ARGUMENT_TYPE, SlashCommandArgument } from './slash-commands/SlashComma | ||
| 20 | 20 | export { MODULE_NAME as NOTE_MODULE_NAME }; |
| 21 | 21 | import { t } from './i18n.js'; |
| 22 | 22 | import { macros, MacroCategory } from './macros/macro-system.js'; |
| 23 | +import { MacrosParser } from './macros.js'; | |
| 24 | +import { power_user } from './power-user.js'; | |
| 23 | 25 | |
| 24 | 26 | const MODULE_NAME = '2_floating_prompt'; // <= Deliberate, for sorting lower than memory |
| 25 | 27 | |
| @@ -585,6 +587,7 @@ export function initAuthorsNote() { | ||
| 585 | 587 | } |
| 586 | 588 | |
| 587 | 589 | function registerAuthorsNoteMacros() { |
| 590 | + if (power_user.experimental_macro_engine) { | |
| 588 | 591 | macros.register('authorsNote', { |
| 589 | 592 | category: MacroCategory.PROMPTS, |
| 590 | 593 | description: t`The contents of the Author's Note`, |
| @@ -600,5 +603,19 @@ function registerAuthorsNoteMacros() { | ||
| 600 | 603 | description: t`The contents of the Default Author's Note`, |
| 601 | 604 | handler: () => extension_settings.note.default ?? '', |
| 602 | 605 | }); |
| 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 | + } | |
| 603 | 621 | } |
| 604 | - | |