Files
clawdbot/src/channels/mention-gating.ts
Peter Steinberger 76d3d58b5c chore: oxfmt
2026-01-16 22:33:47 +00:00

21 lines
689 B
TypeScript

export type MentionGateParams = {
requireMention: boolean;
canDetectMention: boolean;
wasMentioned: boolean;
implicitMention?: boolean;
shouldBypassMention?: boolean;
};
export type MentionGateResult = {
effectiveWasMentioned: boolean;
shouldSkip: boolean;
};
export function resolveMentionGating(params: MentionGateParams): MentionGateResult {
const implicit = params.implicitMention === true;
const bypass = params.shouldBypassMention === true;
const effectiveWasMentioned = params.wasMentioned || implicit || bypass;
const shouldSkip = params.requireMention && params.canDetectMention && !effectiveWasMentioned;
return { effectiveWasMentioned, shouldSkip };
}