import { type SessionFlavor } from "https://dotland.deno.dev/x/grammy@v1.31.0/mod.ts";
A session flavor is a context flavor that holds session data under
ctx.session
.
Session middleware will load the session data of a specific chat from your storage solution, and make it available to you on the context object. Check out the documentation on session middleware to know more, and read the section about sessions on the website.
Methods
Session data on the context object.
WARNING: You have to make sure that your session data is not
undefined by providing an initial value to the session middleware, or
by making sure that ctx.session
is assigned if it is empty! The type
system does not include | undefined
because this is really annoying to
work with.
Accessing ctx.session
by reading or writing will throw if
getSessionKey(ctx) === undefined
for the respective context object
ctx
.