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

Method resolveSlashCommandTarget

src/runtime/adapters/slack.ts:408–442  ·  view source on GitHub ↗
(
    payload: any,
    context: any,
  )

Source from the content-addressed store, hash-verified

406 return SLASH_COMMANDS[commandName];
407 }
408
409 private resolveSlashCommandTarget(
410 payload: any,
411 context: any,
412 ): { channelId?: string; message: string; note?: string } {
413 const teamId = this.getTeamId(payload, context);
414 const channel = payload?.channel_id;
415
416 if (!channel) {
417 return { message: "Missing Slack channel context." };
418 }
419
420 if (this.isDmChannelId(channel)) {
421 return {
422 channelId: `slack-dm-${teamId}-${channel}`,
423 message: "",
424 };
425 }
426
427 const threadTs = this.lastThreadByChannel.get(
428 this.getChannelKey(teamId, channel),
429 );
430 if (!threadTs) {
431 return {
432 message:
433 "No active Skillpack thread found in this channel. Mention the bot first, or run the command inside the thread as `@bot /clear` or `@bot /new`.",
434 };
435 }
436
437 return {
438 channelId: `slack-thread-${teamId}-${channel}-${threadTs}`,
439 message: "",
440 note:
441 "Applied to the most recent active Skillpack thread in this channel.",
442 };
443 }
444
445 private isSupportedDmEvent(event: any): boolean {

Callers 1

handleSlashCommandMethod · 0.95

Calls 3

getTeamIdMethod · 0.95
isDmChannelIdMethod · 0.95
getChannelKeyMethod · 0.95

Tested by

no test coverage detected