Merge pull request #3873 from Teashrock/staging Implemented /getglobalbooks STScript command

3ba7291c35d011adde34712281488b1aea381b2f

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

Signed
1 files changed, +19 -0Ignore whitespace
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 JSON.stringify([]);
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 JSON.stringify(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',