MCPcopy Create free account
hub / github.com/CreminiAI/skillpack / handleDirectMessage

Method handleDirectMessage

src/runtime/adapters/slack.ts:163–200  ·  view source on GitHub ↗
({
    event,
    body,
    context,
    client,
  }: any)

Source from the content-addressed store, hash-verified

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,

Callers 1

registerListenersMethod · 0.95

Calls 7

isSupportedDmEventMethod · 0.95
getTeamIdMethod · 0.95
extractSlackFilesMethod · 0.95
tryAckReactionMethod · 0.95
runAgentMethod · 0.95
broadcastInboundMethod · 0.65

Tested by

no test coverage detected