Expand description
Structs for calling API methods.
The methods from this module can’t be constructed directly; instead, you
construct them using a Bot instance which infers the underlying client
and your bot’s token, or using contexts that infer even more information
from the update, such as the chat ID.
All the methods have a common pattern:
- Methods provide Builder API for optional parameters;
- Methods have the asynchronous
callmethod, which calls the method and resolves with aResult.
For example, here’s how to call SendMessage:
use tbot::types::{chat, parameters::Text};
const CHAT: chat::Id = chat::Id(0);
const MESSAGE: &str = "`tbot` is a super-cool crate!";
let bot = tbot::from_env!("BOT_TOKEN");
bot.send_message(CHAT, Text::markdown(MESSAGE)).call().await.unwrap();§Inline/message methods
Several API methods accept either (chat_id and message_id) or
inline_message_id, and their return type depends on the chosen
parameters. For such methods, tbot provides two structs, e.g. for
editMessageText there are EditMessageText which resolves to
types::Message and EditInlineText which resolves to (). This
brings a type-safer API wrapper, unlike if we only had one method
which would resolve to (() | types::Message).
Structs§
- AddSticker
ToSet - Adds a new sticker to an existing sticker set.
- Answer
Callback Query - Answers a callback query.
- Answer
Inline Query - Answers an inline query.
- Answer
PreCheckout Query - Answers a pre-checkout query.
- Answer
Shipping Query - Answers a shipping query.
- Create
NewSticker Set - Creates a new sticker set.
- Delete
Chat Photo - Deletes a chat’s photo.
- Delete
Chat Sticker Set - Deletes a chat’s sticker set.
- Delete
Message - Deletes a message from a chat.
- Delete
Sticker From Set - Deletes a sticker from a sticker set.
- Edit
Inline Caption - Edits the caption of a media message sent via the inline mode.
- Edit
Inline Location - Edits a live location sent via the inline mode.
- Edit
Inline Media - Edits the media of a message sent via the inline mode.
- Edit
Inline Reply Markup - Edits the inline keyboard of a message sent via the inline mode.
- Edit
Inline Text - Edits the text of a message sent via the inline mode.
- Edit
Message Caption - Edits the caption of a media message sent by the bot itself.
- Edit
Message Location - Edits a live location sent by the bot itself.
- Edit
Message Media - Edits the media of a message sent by the bot itself.
- Edit
Message Reply Markup - Edits the inline keyboard of a message sent by the bot itself.
- Edit
Message Text - Edits the text of a message sent by the bot itself.
- Export
Chat Invite Link - Exports a chat’s invite link.
- Forward
Message - Forwards a message.
- GetChat
- Gets information about a chat.
- GetChat
Administrators - Gets information about a chat’s admins.
- GetChat
Member - Gets information about a chat’s member.
- GetChat
Members Count - Gets a chat’s member count.
- GetFile
- Gets information about a file.
- GetInline
Game High Scores - Gets an excerpt from the high score table of a game sent via the inline mode.
- GetMe
- Gets information about the bot.
- GetMessage
Game High Scores - Gets an excerpt from the high score table of a game sent by the bot itself.
- GetMy
Commands - Gets the list of the bot’s commands.
- GetSticker
Set - Gets a sticker set by its name.
- GetUser
Profile Photos - Gets a user’s profile photos.
- GetWebhook
Info - Gets information about the bot’s webhook.
- Kick
Chat Member - Kicks a member out of a chat.
- Leave
Chat - Leaves a chat.
- PinChat
Message - Pins a message in a chat.
- Promote
Chat Member - Promotes a chat member to an admin.
- Restrict
Chat Member - Restricts a chat member.
- Send
Animation - Sends an animation.
- Send
Audio - Sends an audio.
- Send
Chat Action - Sends a chat action.
- Send
Contact - Sends a contact.
- Send
Dice - Sends a dice.
- Send
Document - Sends a document.
- Send
Game - Sends a game.
- Send
Invoice - Sends an invoice.
- Send
Location - Sends a location.
- Send
Media Group - Sends an album.
- Send
Message - Sends a text message.
- Send
Photo - Sends a photo.
- Send
Poll - Sends a poll.
- Send
Sticker - Sends a sticker.
- Send
Venue - Sends a venue.
- Send
Video - Sends a video.
- Send
Video Note - Sends a video note.
- Send
Voice - Sends a voice.
- SetChat
Administrator Custom Title - Sets a custom title for an admin in a supergroup promoted by the bot.
- SetChat
Description - Sets a chat’s description.
- SetChat
Permissions - Sets a group’s global permissions.
- SetChat
Photo - Sets a chat’s photo.
- SetChat
Sticker Set - Sets a group’s sticker set.
- SetChat
Title - Sets a group’s title.
- SetInline
Game Score - Sets a user’s new high score in a game sent via the inline mode.
- SetMessage
Game Score - Sets a user’s new high score in a game sent by the bot itself.
- SetMy
Commands - Sets the list of the bot’s commands.
- SetPassport
Data Errors - Reports passport errors to the user.
- SetSticker
Position InSet - Changes a sticker’s position in a sticker set.
- SetSticker
SetThumb - Sets the thumb of a sticker set.
- Stop
Inline Location - Stops a live location sent via the inline mode.
- Stop
Message Location - Stops a live location sent by the bot itself.
- Stop
Poll - Stops a poll.
- Unban
Chat Member - Lifts all restrictions from a group’s member.
- Unpin
Chat Message - Unpins a chat message.
- Upload
Sticker File - Uploads a sticker file.