/** * The per-user language every bot surface reads, and the session record * it is read from. Both are shared: a plugin that redeclares either one * gets to disagree with the rest of the library about what a user speaks * and about which fields survive a write. * * Pure except for the storage handle it is handed — Worker-safe, guarded * by test:worker-safe. */ import type { Storage } from "@gramio/storage"; /** BCP-47 tag as stored on a session, e.g. `"en"`, `"pt-BR"`. */ export type Lang = string; /** Spoken when a user has expressed no preference. */ export declare const FALLBACK_LANG: Lang; /** The one session field every plugin reads, whatever else it owns. */ export type LangSession = { language?: Lang; }; /** The acting user's language, off any ctx carrying a session. */ export declare const ctxLang: (ctx: { session?: LangSession; }) => Lang; /** * A whole `@gramio/session` record. `Fields` names the slice the caller * owns; the index signature carries every other plugin's fields through * a read-modify-write untouched. */ export type FullSessionRecord = Fields & LangSession & Record; /** * Read another user's session record straight from storage, under the * calling bot's namespace. * * gramio's session plugin only ever exposes the CURRENT ctx's record, so * a plugin acting on someone else (an admin approving a stranger, a * refund crediting the buyer) has to address the row itself. Write it * back whole: the record is shared, and a partial `storage.set` drops * the fields other plugins own. */ export declare const loadFullRecord: (storage: Storage, ctx: { bot: unknown; }, userId: number) => Promise>; /** The language to address another user in, read from their stored record. */ export declare const langOfUser: (storage: Storage, ctx: { bot: unknown; }, userId: number) => Promise; //# sourceMappingURL=lang.d.ts.map