pub struct BotBuilder<T>{ /* 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>
pub fn with_state<S>(self, state: S) -> BotBuilder<S>
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
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for BotBuilder<T>
impl<T> !RefUnwindSafe for BotBuilder<T>
impl<T> !Send for BotBuilder<T>
impl<T> !Sync for BotBuilder<T>
impl<T> Unpin for BotBuilder<T>
impl<T> !UnwindSafe for BotBuilder<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more