import { Composer } from "https://deno.land/x/grammy_menu@v1.3.0/deps.deno.ts";
This is an advanced method of grammY.
Executes some middleware that can be generated on the fly for each context. Pass a factory function that creates some middleware (or a middleware array even). The factory function will be called once per context, and its result will be executed with the context object.
// The middleware returned by `createMyMiddleware` will be used only once
bot.lazy(ctx => createMyMiddleware(ctx))
You may generate this middleware in an async
fashion.
You can decide to return an empty array ([]
) if you don't want to run
any middleware for a given context object. This is equivalent to
returning an empty instance of Composer
.
Parameters
middlewareFactory: (ctx: C) => MaybePromise<MaybeArray<Middleware<C>>>
The factory function creating the middleware