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