Add macros for Author's Notes Closes #3716
| @@ -17,6 +17,7 @@ import { SlashCommand } from './slash-commands/SlashCommand.js'; | |||
| 17 | import { ARGUMENT_TYPE, SlashCommandArgument } from './slash-commands/SlashCommandArgument.js'; | 17 | import { ARGUMENT_TYPE, SlashCommandArgument } from './slash-commands/SlashCommandArgument.js'; |
| 18 | export { MODULE_NAME as NOTE_MODULE_NAME }; | 18 | export { MODULE_NAME as NOTE_MODULE_NAME }; |
| 19 | import { t } from './i18n.js'; | 19 | import { t } from './i18n.js'; |
| 20 | import { MacrosParser } from './macros.js'; | ||
| 20 | 21 | ||
| 21 | const MODULE_NAME = '2_floating_prompt'; // <= Deliberate, for sorting lower than memory | 22 | const MODULE_NAME = '2_floating_prompt'; // <= Deliberate, for sorting lower than memory |
| 22 | 23 | ||
| @@ -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 | } |