Implemented /getglobalbooks STScript command

e3f5949cc198dbf1ad5645ef59fe4308dc0f7fc5

Teashrock <kajitsu22@gmail.com>

1 files changed, +19 -0Showing whitespace changes
public/scripts/world-info.js+19 -0
@@ -1338,6 +1338,18 @@ function registerWorldInfoSlashCommands() {
13381338 }
13391339 }
13401340
1341+ async function getGlobalBooksCallback() {
1342+ if (!selected_world_info?.length) {
1343+ return [];
1344+ }
1345+
1346+ let entries = selected_world_info.slice();
1347+
1348+ console.debug(`[WI] Selected global world info has ${entries.length} entries`, selected_world_info);
1349+
1350+ return entries;
1351+ }
1352+
13411353 SlashCommandParser.addCommandObject(SlashCommand.fromProps({
13421354 name: 'world',
13431355 callback: onWorldInfoChange,
@@ -1380,6 +1392,13 @@ function registerWorldInfoSlashCommands() {
13801392 aliases: ['getchatlore', 'getchatwi'],
13811393 }));
13821394 SlashCommandParser.addCommandObject(SlashCommand.fromProps({
1395+ name: 'getglobalbooks',
1396+ callback: getGlobalBooksCallback,
1397+ returns: 'list of selected lorebook names',
1398+ helpString: 'Get a list of names of the selected global lorebooks and pass it down the pipe.',
1399+ aliases: ['getgloballore', 'getglobalwi'],
1400+ }));
1401+ SlashCommandParser.addCommandObject(SlashCommand.fromProps({
13831402 name: 'getpersonabook',
13841403 callback: getPersonaBookCallback,
13851404 returns: 'lorebook name',