Optional
ttlStatic
mountRest
...fns: NonemptyReadonlyArray<Middleware<FilteredContext<Ctx, Filter>>>Generates middleware for handling provided update types.
use Composer.on
instead
Rest
...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<Ctx, MountMap[Filter]>>>Registers middleware for handling specified commands.
Rest
...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<C, { Rest
...fns: Middleware<C>[]Registers middleware for handling game queries
Rest
...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<C, CallbackQueryUpdate<GameQuery>>>>Registers middleware for handling updates matching given type guard function.
use Composer::on
Rest
...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<C, U>>>Registers a middleware for handling /help
Rest
...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<C, { Rest
...fns: Middleware<C>[]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.
Use filter utils instead. Support for Message subtype in Composer::on
will be removed in Telegraf v5.
Rest
...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<C, MountMap[Filter]>>>Registers a middleware for handling /settings
Rest
...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<C, { Registers a middleware for handling /start
Rest
...fns: NonemptyReadonlyArray<Middleware<Context<{ Registers a middleware.
Rest
...fns: readonly Middleware<C>[]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<NarrowedContext<C, { Static
composeStatic
creatorGenerates middleware responding only to chat creator.
Rest
...fns: NonemptyReadonlyArray<Middleware<C>>Static
dispatchStatic
dropGenerates middleware for dropping matching updates.
Static
emailRest
...fns: MatchedMiddleware<C, "channel_post" | "message">Static
entityRest
...fns: MatchedMiddleware<C, "channel_post" | "message">Static
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.
Composer.optional
for a more generic version of this method that allows the predicate to operate on ctx
itself
use Composer.on
predicate to decide whether to run the middleware based on the ctx.update
object
Rest
...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<C, U>>>middleware to run if the predicate returns true
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.
Use filter utils instead. Support for Message subtype in Composer.on
will be removed in Telegraf v5.
Rest
...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<Ctx, MountMap[Filter]>>>Static
optionalGenerates optional middleware.
predicate to decide on a context object whether to run the middleware
Rest
...fns: NonemptyReadonlyArray<Middleware<C>>Static
passGenerates middleware that gives up control to the next middleware.
Static
phoneRest
...fns: MatchedMiddleware<C, "channel_post" | "message">Static
privateGenerates middleware running only in private chats.
Rest
...fns: NonemptyReadonlyArray<Middleware<C>>Static
replyRest
...args: [text: string | FmtString, extra?: Omit<{}, "text" | "chat_id">]Static
spoilerRest
...fns: MatchedMiddleware<C, "channel_post" | "message">Static
tapStatic
textRest
...fns: MatchedMiddleware<C, "channel_post" | "message">Static
textRest
...fns: MatchedMiddleware<C, "channel_post" | "message">Static
unwrapStatic
urlRest
...fns: MatchedMiddleware<C, "channel_post" | "message">Generated using TypeDoc
Generates middleware for handling provided update types.
Deprecated
use
Composer.on
instead