Optional ttlStatic mountRest ...fns: NonemptyReadonlyArray<Middleware<FilteredContext<Ctx, Filter>>>Rest ...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<Ctx, MountMap[Filter]>, MountMap[Filter]>>use Composer.on instead
Registers middleware for handling specified commands.
Rest ...fns: NonemptyReadonlyArray<Middleware<Context<{ Registers middleware for handling game queries
Rest ...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<C, CallbackQueryUpdate<GameQuery>>>>Registers a middleware for handling /help
Rest ...fns: NonemptyReadonlyArray<Middleware<Context<{ Registers middleware for handling updates narrowed by update types or filter queries.
Rest ...fns: NonemptyReadonlyArray<Middleware<FilteredContext<C, Filter>>>Registers middleware for handling updates narrowed by update types or message subtypes.
Rest ...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<C, MountMap[Filter]>, MountMap[Filter]>>Use filter utils instead. Support for Message subtype in Composer::on will be removed in Telegraf v5.
Registers a middleware for handling /settings
Rest ...fns: NonemptyReadonlyArray<Middleware<Context<{ Static aclGenerates middleware responding only to specified users.
Rest ...fns: NonemptyReadonlyArray<Middleware<C>>Static actionGenerates middleware for handling matching callback queries.
Rest ...fns: MatchedMiddleware<C, "callback_query">Static adminGenerates middleware responding only to chat admins and chat creator.
Rest ...fns: NonemptyReadonlyArray<Middleware<C>>Static branchmiddleware to run if the predicate returns true
middleware to run if the predicate returns false
Static cashtagRest ...fns: MatchedMiddleware<C, "channel_post" | "message">Static catchRest ...fns: readonly Middleware<C>[]Static chatGenerates middleware running only in specified chat types.
Rest ...fns: NonemptyReadonlyArray<Middleware<C>>Static commandGenerates middleware for handling specified commands.
Rest ...fns: NonemptyReadonlyArray<Middleware<Context<{ Static composeStatic creatorGenerates middleware responding only to chat creator.
Rest ...fns: NonemptyReadonlyArray<Middleware<C>>Static dispatchStatic dropGenerates middleware for dropping matching updates.
Static emailStatic entityStatic filteruse Composer.drop
Static forkGenerates middleware that runs in the background.
Static gameGenerates middleware for handling game queries.
Rest ...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<C, CallbackQueryUpdate<GameQuery>>>>Static groupGenerates middleware running only in groups and supergroups.
Rest ...fns: NonemptyReadonlyArray<Middleware<C>>Static guardGenerates 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
Rest ...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<C, U>, U>>middleware to run if the predicate returns true
Composer.optional for a more generic version of this method that allows the predicate to operate on ctx itself
use Composer.on
Static hashtagRest ...fns: MatchedMiddleware<C, "channel_post" | "message">Static hearsGenerates middleware for handling matching text messages.
Rest ...fns: MatchedMiddleware<C, "text">Static inlineGenerates middleware for handling matching inline queries.
Rest ...fns: MatchedMiddleware<C, "inline_query">Static lazyStatic logStatic mentionRest ...fns: MatchedMiddleware<C, "channel_post" | "message">Static onGenerates middleware for handling updates narrowed by update types or filter queries.
Rest ...fns: NonemptyReadonlyArray<Middleware<FilteredContext<Ctx, Filter>>>Generates middleware for handling updates narrowed by update types or message subtype.
Rest ...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<Ctx, MountMap[Filter]>, MountMap[Filter]>>Use filter utils instead. Support for Message subtype in Composer.on will be removed in Telegraf v5.
Static optionalGenerates optional middleware.
predicate to decide on a context object whether to run the middleware
Rest ...fns: NonemptyReadonlyArray<Middleware<C>>middleware to run if the predicate returns true
Static passGenerates middleware that gives up control to the next middleware.
Static phoneStatic privateGenerates middleware running only in private chats.
Rest ...fns: NonemptyReadonlyArray<Middleware<C>>Static reactionRest ...fns: NonemptyReadonlyArray<Middleware<Context<MessageReactionUpdate> & Omit<C, keyof Context<Update>> & { Static replyRest ...args: [text: string | FmtString<string>, extra?: Omit<{}, "text" | "chat_id">]Static spoilerStatic tapStatic textStatic textStatic unwrapStatic url
Generates middleware for handling provided update types.