Constructs a new Application from a bot token or existing Bot.
Optionaloptions: ApplicationOptions & BotOptionsOptionaloptions: ApplicationOptionsReadonlybotThe underlying Bot API client.
Indicates whether the polling loop is actively running.
ReadonlypersistenceActive persistence store for conversation and context data.
ReadonlyschedulerBackground task scheduler and timer engine.
Compatibility alias for Application.scheduler.
Registers a global error handler callback.
Function invoked when an error occurs during update processing or polling.
Registers an update handler into a numerical priority group.
The BaseHandler instance.
Numerical priority group (lower runs earlier, default: 0).
Registers multiple update handlers simultaneously into a handler group.
Array of BaseHandler instances.
Numerical priority group (default: 0).
Registers an inline callback query button listener shortcut.
Callback data string, RegExp pattern, or boolean (match all).
Callback function invoked when matching button is tapped.
Handler priority group (default: 0).
This Application instance for chaining.
Registers a command handler shortcut (e.g. /start, /help).
Command name (without leading /) or array of command names.
Callback function invoked when matching command is received.
Handler priority group (default: 0).
This Application instance for chaining.
Registers a named linear async/await conversation flow.
Unique string identifier for the conversation.
Sequential asynchronous conversation generator or callback.
This Application instance for chaining.
Enters a registered linear async conversation for a specific user.
Target user identifier.
Name of the registered conversation to enter.
OptionalinitialContext: CallbackContext<Optional initial callback context.
Resolves with the conversation execution promise.
Installs all deferred plugins whose dependencies are now satisfied.
Called automatically by every Application.usePlugin; invoke manually only if you need deterministic installation before registering further plugins.
This Application instance for chaining.
Returns whether a plugin with the given name is currently installed.
Plugin name to look up.
True if the plugin is installed.
Registers a text pattern listener shortcut matching text strings or regular expressions.
String text or RegExp pattern to match in incoming text messages.
Callback function invoked when pattern matches.
Handler priority group (default: 0).
This Application instance for chaining.
Initializes persistent conversation states from persistence storage.
Registers a message filter or update type listener shortcut.
A BaseFilter, update property key string (e.g. 'message', 'inline_query'), or custom predicate function.
Callback function invoked when update matches.
Handler priority group (default: 0).
This Application instance for chaining.
Registers a hook invoked once, in registration order, right before the application starts serving updates (polling or webhook). Use it for asynchronous plugin setup such as opening connections or warming caches.
Callback executed before startup completes.
This Application instance for chaining.
Registers a hook invoked once, in registration order, during Application.stop after the server stops and persisted state is flushed. Use it to release resources held by plugins.
Callback executed during shutdown.
This Application instance for chaining.
Returns the mutable namespaced state object for a plugin, creating it on first access.
Gives plugins their own key space so they never collide with bot code or other plugins in
user_data/bot_data. The object lives for the application's lifetime; persist anything
important into bot_data from an onShutdown hook.
Shape the caller expects the state to have.
Plugin name owning the state (usually plugin.name).
The plugin's state object.
Processes a single update through the registered handler pipeline.
The update payload received from Telegram.
Uninstalls a plugin: runs its optional uninstall hook, deregisters every middleware,
handler, lifecycle hook, and error handler it registered, removes its tagged bot hooks, and
drops its Application.pluginState. The name can be reused afterwards.
Name of the installed plugin to remove.
This Application instance for chaining.
Starts long polling for updates from Telegram Bot API.
Polling configuration options.
Resolves when polling stops.
Starts a webhook HTTP server to receive updates pushed directly by Telegram.
Webhook server configuration options.
Stops the active polling loop or webhook server, shuts down the scheduler, and flushes persistent state.
Registers one or more global middleware functions or middleware-providing objects (e.g. Menu) executed on every incoming update.
Middleware functions or objects with a middleware() method to execute in order.
This Application instance for chaining.
Installs a Plugin into the application.
The plugin's install hook receives this application and wires up middleware, handlers, and
lifecycle hooks synchronously. Installing two plugins with the same name throws. Plugins
whose dependsOn dependencies are not installed yet are deferred and installed
automatically (in ascending priority order) once their dependencies arrive.
The plugin instance to install.
This Application instance for chaining.
StaticbuilderCreates a new fluent ApplicationBuilder instance.
An ApplicationBuilder instance.
Main application class responsible for managing handlers, polling loops, webhook servers, and error handling.
Example