pub struct API {
pub client: Client,
}
Expand description
This is the main Telegram API client. Requires an instance of Client
initialized
with a valid API token.
Fields§
§client: Client
The underlying HTTP client.
Implementations§
source§impl API
impl API
API methods for sending, editing, and deleting messages.
sourcepub async fn send_chat_action(
&self,
req: &SendChatActionRequest
) -> Result<bool>
pub async fn send_chat_action( &self, req: &SendChatActionRequest ) -> Result<bool>
Send a message.
source§impl API
impl API
API methods for sending, editing, and deleting messages.
sourcepub async fn send_message(&self, req: &SendMessageRequest) -> Result<Message>
pub async fn send_message(&self, req: &SendMessageRequest) -> Result<Message>
Send a message to a chat or channel.
Example
api.send_message(&api::SendMessageRequest::new(chat_id, "Hello!")).await;
sourcepub async fn edit_message_text(
&self,
req: &EditMessageTextRequest
) -> Result<Message>
pub async fn edit_message_text( &self, req: &EditMessageTextRequest ) -> Result<Message>
Edit the text of a previously sent message.
Example
api.edit_message_text(
&api::EditMessageTextRequest::new(String::from("Changed my mind: Goodbye world!"))
.with_chat_id(chat_id)
.with_message_id(message_id)
).await;
sourcepub async fn edit_message_caption(
&self,
req: &EditMessageCaptionRequest
) -> Result<Message>
pub async fn edit_message_caption( &self, req: &EditMessageCaptionRequest ) -> Result<Message>
Edit the caption of a message.
sourcepub async fn edit_message_reply_markup(
&self,
req: &EditMessageReplyMarkupRequest
) -> Result<Message>
pub async fn edit_message_reply_markup( &self, req: &EditMessageReplyMarkupRequest ) -> Result<Message>
Edit the reply markup of a message.
sourcepub async fn delete_message(&self, req: &DeleteMessageRequest) -> Result<()>
pub async fn delete_message(&self, req: &DeleteMessageRequest) -> Result<()>
Delete a message.
pub async fn remove_reply_keyboard( &self, chat_id: i64, text: String ) -> Result<Message>
source§impl API
impl API
pub async fn answer_inline_query(&self, req: &AnswerInlineQuery) -> Result<bool>
pub async fn answer_callback_query( &self, req: &AnswerCallbackQueryRequest ) -> Result<bool>
source§impl API
impl API
pub async fn send_sticker(&self, req: &SendStickerRequest) -> Result<Message>
source§impl API
impl API
sourcepub async fn get_updates(&self, req: &GetUpdatesRequest) -> Result<Vec<Update>>
pub async fn get_updates(&self, req: &GetUpdatesRequest) -> Result<Vec<Update>>
Use this method to receive incoming updates using long polling. An Array of Update objects is returned. See the official docs for more information.
Auto Trait Implementations§
impl !RefUnwindSafe for API
impl Send for API
impl Sync for API
impl Unpin for API
impl !UnwindSafe for API
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