(session?: Session)
| 434 | } |
| 435 | |
| 436 | async refreshPluginCommands(session?: Session): Promise<void> { |
| 437 | if (session === undefined) { |
| 438 | this.pluginCommands = []; |
| 439 | this.pluginCommandMap.clear(); |
| 440 | this.setupAutocomplete(); |
| 441 | return; |
| 442 | } |
| 443 | |
| 444 | let defs; |
| 445 | try { |
| 446 | defs = await session.listPluginCommands(); |
| 447 | } catch { |
| 448 | return; |
| 449 | } |
| 450 | const pluginSlashCommands = buildPluginSlashCommands(defs); |
| 451 | this.pluginCommands = pluginSlashCommands.commands; |
| 452 | this.pluginCommandMap.clear(); |
| 453 | for (const [commandName, body] of pluginSlashCommands.commandMap) { |
| 454 | this.pluginCommandMap.set(commandName, body); |
| 455 | } |
| 456 | this.setupAutocomplete(); |
| 457 | } |
| 458 | |
| 459 | // ========================================================================= |
| 460 | // Lifecycle |
no test coverage detected