Files
clawdbot/src/channels/allowlist-match.ts
Peter Steinberger 62354dff9c refactor: share allowlist match metadata
Co-authored-by: thewilloftheshadow <thewilloftheshadow@users.noreply.github.com>
2026-01-18 01:49:25 +00:00

22 lines
508 B
TypeScript

export type AllowlistMatchSource =
| "wildcard"
| "id"
| "name"
| "tag"
| "username"
| "prefixed-id"
| "prefixed-user"
| "prefixed-name"
| "slug"
| "localpart";
export type AllowlistMatch<TSource extends string = AllowlistMatchSource> = {
allowed: boolean;
matchKey?: string;
matchSource?: TSource;
};
export function formatAllowlistMatchMeta(match?: AllowlistMatch | null): string {
return `matchKey=${match?.matchKey ?? "none"} matchSource=${match?.matchSource ?? "none"}`;
}