pub struct Bot {
pub client: BotClient,
}Expand description
Entry point for building and running a Telegram bot.
Bot owns the BotClient and provides a convenient starting point
for setting up the dispatcher.
Fields§
§client: BotClientThe underlying API client.
Implementations§
Source§impl Bot
impl Bot
Sourcepub fn new(token: impl Into<String>) -> BotResult<Self>
pub fn new(token: impl Into<String>) -> BotResult<Self>
Creates a Bot from a bot token.
§Errors
Returns Err if the token format is invalid or the HTTP client fails to build.
Sourcepub fn from_config(config: ClientConfig) -> BotResult<Self>
pub fn from_config(config: ClientConfig) -> BotResult<Self>
Creates a Bot from a ClientConfig for advanced configuration.
§Errors
Returns Err if the HTTP client fails to build.
Sourcepub fn dispatcher(&self) -> DispatcherBuilder
pub fn dispatcher(&self) -> DispatcherBuilder
Returns a DispatcherBuilder pre-configured with this bot’s client.
Auto Trait Implementations§
impl Freeze for Bot
impl !RefUnwindSafe for Bot
impl Send for Bot
impl Sync for Bot
impl Unpin for Bot
impl UnsafeUnpin for Bot
impl !UnwindSafe for Bot
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