Function session

  • Returns middleware that adds ctx.session for storing arbitrary state per session key.

    The default getSessionKey is ${}:${}. If either ctx.from or is undefined, default session key and thus ctx.session are also undefined.

    ⚠️ Session data is kept only in memory by default, which means that all data will be lost when the process is terminated.

    If you want to store data across restarts, or share it among workers, you should use @telegraf/session, or pass custom storage.


    Type Parameters


    • Optional options: SessionOptions<S, C>

    Returns MiddlewareFn<C & {
        session?: S;

Generated using TypeDoc