Struct telereads::TelegramBot
source · pub struct TelegramBot { /* private fields */ }
Expand description
A telegram bot.
Implementations§
source§impl TelegramBot
impl TelegramBot
sourcepub fn with_tokens(telegram_token: &str, goodreads_token: &str) -> TelegramBot
pub fn with_tokens(telegram_token: &str, goodreads_token: &str) -> TelegramBot
Creates a telegram bot using access tokens for Telegram and Goodreads.
sourcepub fn run(&mut self)
pub fn run(&mut self)
Main execution loop of the telegram bot. Fetches updates from telegram and responds to them.
sourcepub fn get_me(&self) -> Result<TelegramResult<User>, Error>
pub fn get_me(&self) -> Result<TelegramResult<User>, Error>
Fetches metadata about the telegram user running the bot.
sourcepub fn get_updates(&mut self) -> Result<TelegramResult<Vec<Update>>, Error>
pub fn get_updates(&mut self) -> Result<TelegramResult<Vec<Update>>, Error>
Fetches updates from telegram (new/edites messages, inline queries, etc). This method uses self.offset as a checkpoint to ensure that each update is only fetched and processed once.
sourcepub fn answer_inline_query(&self, query: InlineQuery) -> Result<bool, Error>
pub fn answer_inline_query(&self, query: InlineQuery) -> Result<bool, Error>
Fetches a list of Goodreads books which match the search query received from a user. The books are returned to the user as a pop-up list of results.
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for TelegramBot
impl Send for TelegramBot
impl Sync for TelegramBot
impl Unpin for TelegramBot
impl !UnwindSafe for TelegramBot
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