mic-bot/bot/ctx.ts

30 lines
729 B
TypeScript
Raw Normal View History

2024-10-19 10:00:35 +00:00
import { Context, SessionFlavor } from "https://deno.land/x/grammy@v1.30.0/mod.ts";
import { CaptchaSessionData } from "./normal_mode/captcha.ts";
interface SessionData {
// Can be useful if will decide to extend
// with some websites
inner_id: string
is_banned: boolean,
captcha_solved: boolean
captcha_data?: CaptchaSessionData
invite_link?: string
chat_participant: boolean
}
const defaultSessionData = (): SessionData => {
const innerId = crypto.randomUUID() // UUIDv4
return {
inner_id: innerId,
is_banned: false,
captcha_solved: false,
chat_participant: false,
}
}
type Ctx = Context & SessionFlavor<SessionData>;
export type { SessionData, Ctx }
export { defaultSessionData }