({
command,
body,
context,
ack,
}: any)
| 257 | await this.runAgent(channelId, userText, client, route, attachments); |
| 258 | } |
| 259 | |
| 260 | private async handleSlashCommand({ |
| 261 | command, |
| 262 | body, |
| 263 | context, |
| 264 | ack, |
| 265 | }: any): Promise<void> { |
| 266 | const commandName = command?.command; |
| 267 | const mapped = commandName ? this.resolveSlashCommand(commandName) : undefined; |
| 268 | |
| 269 | if (!this.agent || !mapped) { |
| 270 | await this.safeAck(ack, "Unsupported slash command."); |
| 271 | return; |
| 272 | } |
| 273 | |
| 274 | const resolved = this.resolveSlashCommandTarget(body || command, context); |
| 275 | if (!resolved.channelId) { |
| 276 | await this.safeAck(ack, resolved.message); |
| 277 | return; |
| 278 | } |
| 279 | |
| 280 | const result = await this.agent.handleCommand(mapped, resolved.channelId); |
| 281 | |
| 282 | const parts = [result.message || `${commandName} executed.`]; |
| 283 | if (resolved.note) { |
| 284 | parts.push(resolved.note); |
| 285 | } |
| 286 | |
| 287 | await this.safeAck(ack, parts.join("\n")); |
| 288 | } |
| 289 | |
| 290 | // ------------------------------------------------------------------------- |
no test coverage detected