SessionFlavor
A session flavor is a context flavor that holds session data under ctx
.
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 (getter)
// Overload 1
get session(): S;
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
is assigned if it is empty! The type system does not include | undefined
because this is really annoying to work with.
Accessing ctx
by reading or writing will throw if get
for the respective context object ctx
.