pub struct ApplicationBuilder<State = NoToken> { /* private fields */ }Expand description
Typestate builder for constructing an Application.
The builder enforces at compile time that a bot token is set before
build can be called, using the
NoToken / HasToken marker types.
Implementations§
Source§impl ApplicationBuilder
impl ApplicationBuilder
Sourcepub fn new() -> ApplicationBuilder
pub fn new() -> ApplicationBuilder
Create a new builder with no token and default settings.
Source§impl<S> ApplicationBuilder<S>
impl<S> ApplicationBuilder<S>
Sourcepub fn request(self, request: Arc<dyn BaseRequest>) -> ApplicationBuilder<S>
pub fn request(self, request: Arc<dyn BaseRequest>) -> ApplicationBuilder<S>
Set a custom HTTP request backend for the bot.
Sourcepub fn base_url(self, url: impl Into<String>) -> ApplicationBuilder<S>
pub fn base_url(self, url: impl Into<String>) -> ApplicationBuilder<S>
Override the base URL for Telegram Bot API requests.
Sourcepub fn base_file_url(self, url: impl Into<String>) -> ApplicationBuilder<S>
pub fn base_file_url(self, url: impl Into<String>) -> ApplicationBuilder<S>
Override the base URL for downloading files from Telegram.
Sourcepub fn defaults(self, defaults: Defaults) -> ApplicationBuilder<S>
pub fn defaults(self, defaults: Defaults) -> ApplicationBuilder<S>
Set default values (e.g. parse_mode) applied to every API call.
Sourcepub fn arbitrary_callback_data(self, maxsize: usize) -> ApplicationBuilder<S>
pub fn arbitrary_callback_data(self, maxsize: usize) -> ApplicationBuilder<S>
Enable the arbitrary callback data cache with the given maximum size.
Sourcepub fn rate_limiter(self, _rl: ()) -> ApplicationBuilder<S>
pub fn rate_limiter(self, _rl: ()) -> ApplicationBuilder<S>
Sets the rate-limiter placeholder (feature disabled).
Sourcepub fn context_types(self, ct: ContextTypes) -> ApplicationBuilder<S>
pub fn context_types(self, ct: ContextTypes) -> ApplicationBuilder<S>
Set custom context types for the application.
Sourcepub fn concurrent_updates(self, n: usize) -> ApplicationBuilder<S>
pub fn concurrent_updates(self, n: usize) -> ApplicationBuilder<S>
Set the maximum number of concurrent update processing tasks. Minimum is 1.
Sourcepub fn post_init(
self,
hook: Arc<dyn Fn(Arc<Application>) -> Pin<Box<dyn Future<Output = ()> + Send>> + Sync + Send>,
) -> ApplicationBuilder<S>
pub fn post_init( self, hook: Arc<dyn Fn(Arc<Application>) -> Pin<Box<dyn Future<Output = ()> + Send>> + Sync + Send>, ) -> ApplicationBuilder<S>
Register a hook to run after the application has been initialized.
Sourcepub fn post_stop(
self,
hook: Arc<dyn Fn(Arc<Application>) -> Pin<Box<dyn Future<Output = ()> + Send>> + Sync + Send>,
) -> ApplicationBuilder<S>
pub fn post_stop( self, hook: Arc<dyn Fn(Arc<Application>) -> Pin<Box<dyn Future<Output = ()> + Send>> + Sync + Send>, ) -> ApplicationBuilder<S>
Register a hook to run after the application has stopped.
Sourcepub fn post_shutdown(
self,
hook: Arc<dyn Fn(Arc<Application>) -> Pin<Box<dyn Future<Output = ()> + Send>> + Sync + Send>,
) -> ApplicationBuilder<S>
pub fn post_shutdown( self, hook: Arc<dyn Fn(Arc<Application>) -> Pin<Box<dyn Future<Output = ()> + Send>> + Sync + Send>, ) -> ApplicationBuilder<S>
Register a hook to run after the application has been fully shut down.
Source§impl ApplicationBuilder<HasToken>
impl ApplicationBuilder<HasToken>
Sourcepub fn build(self) -> Arc<Application>
pub fn build(self) -> Arc<Application>
Consume the builder and construct the Application.