Implemented /getglobalbooks STScript command
| @@ -1338,6 +1338,18 @@ function registerWorldInfoSlashCommands() { | ||
| 1338 | 1338 | } |
| 1339 | 1339 | } |
| 1340 | 1340 | |
| 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 | + | |
| 1341 | 1353 | SlashCommandParser.addCommandObject(SlashCommand.fromProps({ |
| 1342 | 1354 | name: 'world', |
| 1343 | 1355 | callback: onWorldInfoChange, |
| @@ -1380,6 +1392,13 @@ function registerWorldInfoSlashCommands() { | ||
| 1380 | 1392 | aliases: ['getchatlore', 'getchatwi'], |
| 1381 | 1393 | })); |
| 1382 | 1394 | 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({ | |
| 1383 | 1402 | name: 'getpersonabook', |
| 1384 | 1403 | callback: getPersonaBookCallback, |
| 1385 | 1404 | returns: 'lorebook name', |