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

Method handleSlashCommand

src/runtime/adapters/slack.ts:259–287  ·  view source on GitHub ↗
({
    command,
    body,
    context,
    ack,
  }: any)

Source from the content-addressed store, hash-verified

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 // -------------------------------------------------------------------------

Callers 1

registerListenersMethod · 0.95

Calls 4

resolveSlashCommandMethod · 0.95
safeAckMethod · 0.95
handleCommandMethod · 0.65

Tested by

no test coverage detected