MCPcopy Create free account
hub / github.com/adcontextprotocol/adcp / checkAddieThreadParticipation

Function checkAddieThreadParticipation

server/src/addie/bolt-app.ts:398–413  ·  view source on GitHub ↗

* Check if Addie has already participated in a thread. * Used to determine if replies in a thread should be treated as implicit @mentions. * * When a user replies to a thread where Addie has already responded, * we should respond automatically without requiring an explicit @mention. * This crea

(
  channelId: string,
  threadTs: string,
  botUserId: string
)

Source from the content-addressed store, hash-verified

396 * a duplicate API call when building thread context.
397 */
398async function checkAddieThreadParticipation(
399 channelId: string,
400 threadTs: string,
401 botUserId: string
402): Promise<ThreadParticipationResult> {
403 try {
404 const messages = await getThreadReplies(channelId, threadTs);
405 // Check if any message in the thread is from Addie (matches bot user ID)
406 // Note: Slack messages from bots have a 'user' field matching the bot's user ID
407 const participated = messages.some(msg => msg.user === botUserId);
408 return { participated, messages };
409 } catch (error) {
410 logger.warn({ error, channelId, threadTs }, 'Addie Bolt: Failed to check thread participation');
411 return { participated: false, messages: [] };
412 }
413}
414
415/** Delay (ms) before Addie responds in channel threads when not explicitly mentioned.
416 * Gives humans time to reply first. After the delay, re-checks the thread

Callers 1

handleChannelMessageFunction · 0.85

Calls 2

getThreadRepliesFunction · 0.85
warnMethod · 0.80

Tested by

no test coverage detected