INNER CODE UNIT · TypeScript

decideSubscribedThreadAction

Beever-AI/beever-atlas · bot/src/index.ts:297

async function decideSubscribedThreadAction(
  thread: ThreadForParticipants,
  message: { isMention?: boolean; author?: { isMe?: boolean; isBot?: boolean | "unknown" } },
): Promise<"answer" | "skip" | "unsubscribe"> {
  return decideSubscribedThreadActionWithLookup(
    {
      isMe: message.author?.isMe === true,
      isBot: message.author?.isBot,
      isMention: message.isMention === true,
      quietThreshold: HUMAN_QUIET_THRESHOLD,
    },
    () => getHumanCount(thread),
  );
}

/** Human participant count for a thread, served from a short TTL cache. */
async function getHumanCount(thread: ThreadForParticipants): Promise<number | undefined> {
  const cached = participantCache.get(thread.id);

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…