Struct telegram_bot2::BotBuilder
source · pub struct BotBuilder<T>where
T: Sync + Send + 'static,{ /* private fields */ }
Expand description
Builds a bot. This should be used in combination with the bot macro
Implementations§
source§impl BotBuilder<()>
impl BotBuilder<()>
sourcepub fn new() -> BotBuilder<()>
pub fn new() -> BotBuilder<()>
Builds a bot and uses the environment variable BOT_TOKEN
as token or extract it from the BOT_TOKEN_FILE
file. If both are defined, BOT_TOKEN
is used.
sourcepub fn new_with_token(token: String) -> BotBuilder<()>
pub fn new_with_token(token: String) -> BotBuilder<()>
Builds a bot with the given token
source§impl<T: Sync + Send + 'static> BotBuilder<T>
impl<T: Sync + Send + 'static> BotBuilder<T>
sourcepub fn with_state<S>(self, state: S) -> BotBuilder<S>where
S: Sync + Send + 'static,
pub fn with_state<S>(self, state: S) -> BotBuilder<S>where S: Sync + Send + 'static,
Add a shared state to the bot The state can be used by any update or command handler
sourcepub fn handlers(self, handlers: Vec<GenericHandler<T>>) -> Self
pub fn handlers(self, handlers: Vec<GenericHandler<T>>) -> Self
Set the update handler of the bot
sourcepub fn update_limit(self, limit: i64) -> BotBuilder<T>
pub fn update_limit(self, limit: i64) -> BotBuilder<T>
Set the maximum fetched updates per poll Default is 100, and max is 100
sourcepub fn timeout(self, timeout: i64) -> BotBuilder<T>
pub fn timeout(self, timeout: i64) -> BotBuilder<T>
Specify the time (in seconds) before the polling exits with timeout Should be a stricly positive integer
sourcepub fn interval(self, interval: Duration) -> BotBuilder<T>
pub fn interval(self, interval: Duration) -> BotBuilder<T>
Minimum waiting time between two pollings