* Check if a queued command is a slash command (value starts with '/').
(cmd: QueuedCommand)
| 18 | * Check if a queued command is a slash command (value starts with '/'). |
| 19 | */ |
| 20 | function isSlashCommand(cmd: QueuedCommand): boolean { |
| 21 | if (typeof cmd.value === 'string') { |
| 22 | return ( |
| 23 | cmd.value.trim().startsWith('/') && |
| 24 | (!cmd.skipSlashCommands || cmd.bridgeOrigin === true) |
| 25 | ) |
| 26 | } |
| 27 | // For ContentBlockParam[], check the first text block |
| 28 | for (const block of cmd.value) { |
| 29 | if (block.type === 'text') { |
| 30 | return ( |
| 31 | block.text.trim().startsWith('/') && |
| 32 | (!cmd.skipSlashCommands || cmd.bridgeOrigin === true) |
| 33 | ) |
| 34 | } |
| 35 | } |
| 36 | return false |
| 37 | } |
| 38 | |
| 39 | /** |
| 40 | * Processes commands from the queue. |
no outgoing calls
no test coverage detected