/** * Static allow-list by id AND/OR username — stateless, no storage/session. * * The heavyweight counterpart is `bot/access-control` (approve/deny flow, * revocable store, admin menu — needs session + storage). This is the light * version: a hardcoded allow-list you control in code, gating by Telegram user * id and/or @username. Decorates every message/callback context with * `ctx.allowed` (boolean); you gate in your handlers (`if (!ctx.allowed) return`). * * Caveat on usernames: a @username is optional and can change, and the Bot API * has no way to resolve a username → id ahead of time. Prefer `ids` when you * know them; `usernames` is the pragmatic fallback when you only have the handle. * * import { allowList } from '@adriangalilea/utils/bot/allow-list' * * bot * .extend(allowList({ ids: [123456789], usernames: ['mrwagecuck'] })) * .on('message', (ctx) => { if (!ctx.allowed) return; ... }) */ import { Plugin } from "gramio"; export type AllowListOptions = { /** Allowed Telegram user ids — exact and robust. */ ids?: ReadonlyArray; /** Allowed @usernames — case-insensitive, leading `@` optional. Less robust (usernames change). */ usernames?: ReadonlyArray; }; /** Returns whether a user (by id/username) is on the allow-list — pure, framework-free. */ export declare const makeAllowList: (opts?: AllowListOptions) => (user?: { id?: number; username?: string; }) => boolean; /** gramio plugin: decorates `ctx.allowed` (boolean) for message/callback updates. */ export declare const allowList: (opts?: AllowListOptions) => Plugin<{}, import("gramio").DeriveDefinitions & { global: { allowed: boolean; }; }, {}>; //# sourceMappingURL=allow-list.d.ts.map