Optional
botPrivate
Optional
botReadonly
contextPrivate
Readonly
optionsPrivate
Optional
pollingAssign to this to customise the webhook filter middleware.
{ hookPath, secretToken }
will be bound to this rather than the Telegraf instance.
Remember to assign a regular function and not an arrow function so it's bindable.
Optional
secretPrivate
Optional
webhookStatic
mountGenerates middleware for handling provided update types.
use Composer.on
instead
Rest
...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]>>>Private
tokenuse ctx.telegram.webhookReply
use ctx.telegram.webhookReply
Registers middleware for handling specified commands.
Rest
...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<C, { Specify a url to receive incoming updates via webhook. Returns an Express-style middleware you can pass to app.use()
Registers middleware for handling game queries
Rest
...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<C, CallbackQueryUpdate<GameQuery>>>>Private
getRegisters middleware for handling updates matching given type guard function.
use Composer::on
Rest
...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<C, U>>>Private
handleRegisters a middleware for handling /help
Rest
...fns: NonemptyReadonlyArray<Middleware<NarrowedContext<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<{ Private
startPrivate
startOptional
tlsOptions: TlsOptionsOptional
port: numberOptional
host: stringOptional
cb: RequestListener<typeof IncomingMessage, typeof ServerResponse>Optional
secretToken: stringRegisters a middleware.
Rest
...fns: readonly Middleware<C>[]You must call bot.telegram.setWebhook
for this to work.
You should probably use createWebhook instead.
Optional
secretStatic
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
Set manually to avoid implicit
getMe
call inlaunch
orwebhookCallback