30 lines
729 B
TypeScript
30 lines
729 B
TypeScript
|
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 }
|