({
event,
body,
context,
client,
}: any)
| 161 | // ------------------------------------------------------------------------- |
| 162 | |
| 163 | private async handleDirectMessage({ |
| 164 | event, |
| 165 | body, |
| 166 | context, |
| 167 | client, |
| 168 | }: any): Promise<void> { |
| 169 | if (!this.agent || !this.isSupportedDmEvent(event)) { |
| 170 | return; |
| 171 | } |
| 172 | |
| 173 | const text = (event.text || "").trim(); |
| 174 | const teamId = this.getTeamId(body, context); |
| 175 | const channelId = `slack-dm-${teamId}-${event.channel}`; |
| 176 | const route: SlackRoute = { channel: event.channel }; |
| 177 | this.ipcBroadcaster?.broadcastInbound( |
| 178 | channelId, |
| 179 | "slack", |
| 180 | { |
| 181 | id: String(event.user || ""), |
| 182 | username: String(event.user || ""), |
| 183 | }, |
| 184 | text, |
| 185 | ); |
| 186 | |
| 187 | // Extract file attachments |
| 188 | const attachments = await this.extractSlackFiles(event, channelId, client); |
| 189 | |
| 190 | if (!text && attachments.length === 0) return; |
| 191 | |
| 192 | await this.tryAckReaction(client, event); |
| 193 | |
| 194 | if (text && await this.tryHandleInlineCommand(text, channelId, client, route)) { |
| 195 | return; |
| 196 | } |
| 197 | |
| 198 | const userText = text || "(User sent an attachment)"; |
| 199 | await this.runAgent(channelId, userText, client, route, attachments); |
| 200 | } |
| 201 | |
| 202 | private async handleMention({ |
| 203 | event, |
no test coverage detected