pub struct CallbackQuery {
pub raw: Update,
pub state: State,
/* private fields */
}Expand description
Update that bots receive when a user presses one of the bot’s inline callback buttons.
You should always CallbackQuery::answer these queries, even if you have no data to display
to the user, because otherwise they will think the bot is non-responsive (the button spinner
will timeout).
Fields§
§raw: Update§state: StateImplementations§
Source§impl CallbackQuery
impl CallbackQuery
Sourcepub fn peer_id(&self) -> PeerId
pub fn peer_id(&self) -> PeerId
The Self::peer’s identifier.
Sourcepub async fn peer_ref(&self) -> Option<PeerRef>
pub async fn peer_ref(&self) -> Option<PeerRef>
Cached reference to the Self::peer, if it is in cache.
Sourcepub fn peer(&self) -> Option<&Peer>
pub fn peer(&self) -> Option<&Peer>
The peer where the callback query occured, if it is in cache.
Sourcepub fn sender_id(&self) -> PeerId
pub fn sender_id(&self) -> PeerId
The Self::sender’s identifier.
Sourcepub async fn sender_ref(&self) -> Option<PeerRef>
pub async fn sender_ref(&self) -> Option<PeerRef>
Cached reference to the Self::sender, if it is in cache.
Sourcepub fn sender(&self) -> Option<&Peer>
pub fn sender(&self) -> Option<&Peer>
The user who sent this callback query, if it is in cache.
Sourcepub fn data(&self) -> &[u8] ⓘ
pub fn data(&self) -> &[u8] ⓘ
They binary payload data contained by the inline button which was pressed.
This data cannot be faked by the client, since Telegram will only accept “button presses” on data that actually existed in the buttons of the message, so you do not need to perform any sanity checks.
Trivia: it used to be possible to fake the callback data, but a server-side check was added circa 2018 to prevent malicious clients from doing so.
Sourcepub fn is_from_inline(&self) -> bool
pub fn is_from_inline(&self) -> bool
Whether the callback query was generated from an inline message.
Sourcepub async fn load_message(&self) -> Result<Message, InvocationError>
pub async fn load_message(&self) -> Result<Message, InvocationError>
Load the Message that contains the pressed inline button.
Trait Implementations§
Source§impl Clone for CallbackQuery
impl Clone for CallbackQuery
Source§fn clone(&self) -> CallbackQuery
fn clone(&self) -> CallbackQuery
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more