INNER CODE UNIT · TypeScript

sharedBotScopeMatches

agentconnect-md/agentconnect · packages/activation-policy/src/index.ts:499

export function sharedBotScopeMatches(r: SharedBotRoute, msg: SharedBotMessageFacts): boolean {
  if (r.scope?.channel !== undefined && r.scope.channel !== msg.channel) return false
  if (r.scope?.thread !== undefined && r.scope.thread !== msg.thread) return false
  return true
}

function sharedBotKindMatches(r: SharedBotRoute, msg: SharedBotMessageFacts, botUserId: string | undefined): boolean {
  switch (r.match.kind) {
    case 'mention':
      return botUserId !== undefined && msg.mentionedBots.includes(botUserId)
    case 'dm':
      return msg.isDm
    case 'keyword':
      return msg.text.toLowerCase().includes(r.match.value.toLowerCase())
    case 'auto':
      return true
    case 'decision':
      return !msg.sender.isBot

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…