OptionalttlStaticmountGenerates middleware for handling updates narrowed by update types or filter queries.
Generates middleware for handling updates narrowed by update types or message subtype.
Registers middleware for handling matching callback queries.
Registers middleware for handling specified commands.
Registers middleware for dropping matching updates.
Registers middleware for handling game queries
Registers middleware for handling updates matching given type guard function.
Registers middleware for handling matching text messages.
Registers a middleware for handling /help
Registers middleware for handling matching inline queries.
Registers middleware for handling updates narrowed by update types or filter queries.
Registers middleware for handling updates narrowed by update types or message subtypes.
Registers a middleware for handling /settings
Registers a middleware for handling /start
StaticaclGenerates middleware responding only to specified users.
StaticactionGenerates middleware for handling matching callback queries.
StaticadminGenerates middleware responding only to chat admins and chat creator.
Staticbranchmiddleware to run if the predicate returns true
middleware to run if the predicate returns false
StaticcashtagStaticcatchStaticchatGenerates middleware running only in specified chat types.
StaticcommandGenerates middleware for handling specified commands.
StaticcomposeStaticcreatorGenerates middleware responding only to chat creator.
StaticdispatchStaticdropGenerates middleware for dropping matching updates.
StaticemailStaticentityStaticfilterStaticforkGenerates middleware that runs in the background.
StaticgameGenerates middleware for handling game queries.
StaticgroupGenerates middleware running only in groups and supergroups.
StaticguardGenerates optional middleware based on a predicate that only operates on ctx.update.
Example:
import { Composer, Update } from 'telegraf'
const predicate = (u): u is Update.MessageUpdate => 'message' in u
const middleware = Composer.guard(predicate, (ctx) => {
const message = ctx.update.message
})
Note that Composer.on('message') is preferred over this.
predicate to decide whether to run the middleware based on the ctx.update object
middleware to run if the predicate returns true
StatichashtagStatichearsGenerates middleware for handling matching text messages.
StaticinlineGenerates middleware for handling matching inline queries.
StaticlazyStaticlogStaticmentionStaticonGenerates middleware for handling updates narrowed by update types or filter queries.
Generates middleware for handling updates narrowed by update types or message subtype.
StaticoptionalGenerates optional middleware.
predicate to decide on a context object whether to run the middleware
middleware to run if the predicate returns true
StaticpassGenerates middleware that gives up control to the next middleware.
StaticphoneStaticprivateGenerates middleware running only in private chats.
StaticreactionStaticreplyStaticspoilerStatictapStatictextStatictextStaticunwrapStaticurl
Generates middleware for handling provided update types.