Optional
options:Partial<Options<C>>Optional
OverridesComposer.constructor
Optional
botSet manually to avoid implicitgetMe
call inlaunch
orwebhookCallback
Private
Optional
botReadonly
contextPrivate
Readonly
optionsPrivate
Optional
pollingAssign to this to customise the webhook filter middleware.{ path, 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.
Use path instead
Optional
secretPrivate
Optional
webhookStatic
mountGenerates middleware for handling provided update types.
Rest
...fns:NonemptyReadonlyArray<Middleware<FilteredContext<Ctx,Filter>>>Rest
useComposer.on
instead
Generates middleware for handling provided update types.
Rest
...fns:NonemptyReadonlyArray<Middleware<NarrowedContext<Ctx,MountMap[Filter]>,MountMap[Filter]>>Rest
useComposer.on
instead
Private
tokenusectx.telegram.webhookReply
usectx.telegram.webhookReply
Registers middleware for handling matching callback queries.
Rest
...fns:MatchedMiddleware<C,"callback_query">Rest
Rest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Inherited fromComposer.cashtag
Override error handling
Registers middleware for handling specified commands.
Rest
...fns:NonemptyReadonlyArray<Middleware<Context<{Rest
Inherited fromComposer.command
Specify a url to receive incoming updates via webhook.Returns an Express-style middleware you can pass to app.use()
Registers middleware for dropping matching updates.
Rest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
useComposer::drop
Registers middleware for handling game queries
Rest
...fns:NonemptyReadonlyArray<Middleware<NarrowedContext<C,CallbackQueryUpdate<GameQuery>>>>Rest
Inherited fromComposer.gameQuery
Private
getOptional
path?:stringRegisters middleware for handling updatesmatching given type guard function.
Rest
...fns:NonemptyReadonlyArray<Middleware<NarrowedContext<C,U>,U>>Rest
useComposer::on
Private
handleOptional
webhookResponse:ServerResponse<IncomingMessage>Optional
Rest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Inherited fromComposer.hashtag
Registers middleware for handling matching text messages.
Rest
...fns:MatchedMiddleware<C,"text">Rest
Registers a middleware for handling /help
Rest
...fns:NonemptyReadonlyArray<Middleware<Context<{Rest
Registers middleware for handling matching inline queries.
Rest
...fns:MatchedMiddleware<C,"inline_query">Rest
Inherited fromComposer.inlineQuery
Optional
onLaunch:(() =>void)Optional
Optional
onLaunch:(() =>void)Optional
Rest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Inherited fromComposer.mention
Registers middleware for handling updates narrowed by update types or filter queries.
Rest
...fns:NonemptyReadonlyArray<Middleware<FilteredContext<C,Filter>>>Rest
Registers middleware for handling updates narrowed by update types or message subtypes.
Rest
...fns:NonemptyReadonlyArray<Middleware<NarrowedContext<C,MountMap[Filter]>,MountMap[Filter]>>Rest
Use filter utils instead. Support for Message subtype inComposer::on
will be removed in Telegraf v5.
Rest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Rest
...fns:NonemptyReadonlyArray<Middleware<Context<MessageReactionUpdate> &Omit<C,keyofContext<Update>> &{Rest
Inherited fromComposer.reaction
Registers a middleware for handling /settings
Rest
...fns:NonemptyReadonlyArray<Middleware<Context<{Rest
Inherited fromComposer.settings
Rest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Inherited fromComposer.spoiler
Registers a middleware for handling /start
Rest
...fns:NonemptyReadonlyArray<Middleware<Context<{Rest
Private
startPrivate
startOptional
tlsOptions:TlsOptionsOptional
Optional
port:numberOptional
Optional
host:stringOptional
Optional
cb:RequestListener<typeofIncomingMessage,typeofServerResponse>Optional
Optional
secretToken:stringOptional
Rest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Inherited fromComposer.textLink
Rest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Inherited fromComposer.textMention
Rest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Registers a middleware.
Rest
...fns:readonlyMiddleware<C>[]Rest
You must callbot.telegram.setWebhook
for this to work.You should probably useTelegraf.createWebhook instead.
Optional
secretStatic
aclGenerates middleware responding only to specified users.
Rest
...fns:NonemptyReadonlyArray<Middleware<C>>Rest
Static
actionGenerates middleware for handling matching callback queries.
Rest
...fns:MatchedMiddleware<C,"callback_query">Rest
Static
adminGenerates middleware responding only to chat admins and chat creator.
Rest
...fns:NonemptyReadonlyArray<Middleware<C>>Rest
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">Rest
Inherited fromComposer.cashtag
Static
catchRest
...fns:readonlyMiddleware<C>[]Rest
Static
chatGenerates middleware running only in specified chat types.
Rest
...fns:NonemptyReadonlyArray<Middleware<C>>Rest
Inherited fromComposer.chatType
Static
commandGenerates middleware for handling specified commands.
Rest
...fns:NonemptyReadonlyArray<Middleware<Context<{Rest
Inherited fromComposer.command
Static
composeInherited fromComposer.compose
Static
creatorGenerates middleware responding only to chat creator.
Rest
...fns:NonemptyReadonlyArray<Middleware<C>>Rest
Inherited fromComposer.creator
Static
dispatchInherited fromComposer.dispatch
Static
dropGenerates middleware for dropping matching updates.
Static
emailRest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Static
entityRest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Inherited fromComposer.entityText
Static
filteruseComposer.drop
Static
forkGenerates middleware that runs in the background.
Static
gameGenerates middleware for handling game queries.
Rest
...fns:NonemptyReadonlyArray<Middleware<NarrowedContext<C,CallbackQueryUpdate<GameQuery>>>>Rest
Inherited fromComposer.gameQuery
Static
groupGenerates middleware running only in groups and supergroups.
Rest
...fns:NonemptyReadonlyArray<Middleware<C>>Rest
Inherited fromComposer.groupChat
Static
guardGenerates optional middleware based on a predicate that only operates onctx.update
.
Example:
import {Composer,Update }from'telegraf'
constpredicate = (u):uisUpdate.MessageUpdate=>'message'inu
constmiddleware =Composer.guard(predicate, (ctx)=> {
constmessage =ctx.update.message
})
Note thatComposer.on('message')
is preferred over this.
predicate to decide whether to run the middleware based on thectx.update
object
Rest
...fns:NonemptyReadonlyArray<Middleware<NarrowedContext<C,U>,U>>middleware to run if the predicate returns true
Rest
Composer.optional
for a more generic version of this method that allows the predicate to operate onctx
itself
useComposer.on
Static
hashtagRest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Inherited fromComposer.hashtag
Static
hearsGenerates middleware for handling matching text messages.
Rest
...fns:MatchedMiddleware<C,"text">Rest
Static
inlineGenerates middleware for handling matching inline queries.
Rest
...fns:MatchedMiddleware<C,"inline_query">Rest
Inherited fromComposer.inlineQuery
Static
lazyStatic
logStatic
mentionRest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Inherited fromComposer.mention
Static
onGenerates middleware for handling updates narrowed by update types or filter queries.
Rest
...fns:NonemptyReadonlyArray<Middleware<FilteredContext<Ctx,Filter>>>Rest
Generates middleware for handling updates narrowed by update types or message subtype.
Rest
...fns:NonemptyReadonlyArray<Middleware<NarrowedContext<Ctx,MountMap[Filter]>,MountMap[Filter]>>Rest
Use filter utils instead. Support for Message subtype inComposer.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
Rest
Inherited fromComposer.optional
Static
passGenerates middleware that gives up control to the next middleware.
Inherited fromComposer.passThru
Static
phoneRest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Static
privateGenerates middleware running only in private chats.
Rest
...fns:NonemptyReadonlyArray<Middleware<C>>Rest
Inherited fromComposer.privateChat
Static
reactionRest
...fns:NonemptyReadonlyArray<Middleware<Context<MessageReactionUpdate> &Omit<C,keyofContext<Update>> &{Rest
Inherited fromComposer.reaction
Static
replyRest
...args:[text:string |FmtString<string>,extra?:Omit<{},"text" |"chat_id">]Rest
Static
spoilerRest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Inherited fromComposer.spoiler
Static
tapStatic
textRest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Inherited fromComposer.textLink
Static
textRest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Inherited fromComposer.textMention
Static
unwrapStatic
urlRest
...fns:MatchedMiddleware<C,"channel_post" |"message">Rest
Generated usingTypeDoc