Module

x/grammy/mod.ts>Composer#use

The Telegram Bot Framework.
Very Popular
Go to Latest
method Composer.prototype.use
import { Composer } from "https://dotland.deno.dev/x/grammy@v1.31.1/mod.ts";

Registers some middleware that receives all updates. It is installed by concatenating it to the end of all previously installed middleware.

Often, this method is used to install middleware that behaves like a plugin, for example session middleware.

bot.use(session())

This method returns a new instance of composer. The returned instance can be further extended, and all changes will be regarded here. Confer the documentation on the website if you want to know more about how the middleware system in grammY works, especially when it comes to chaining the method calls (use( ... ).use( ... ).use( ... )).

Parameters

...middleware: Array<Middleware<C>>

The middleware to register