Struct grammers_client::types::callback_query::CallbackQuery
source · pub struct CallbackQuery { /* private fields */ }
Expand description
Represents a callback query update, which occurs 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).
Implementations§
source§impl CallbackQuery
impl CallbackQuery
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 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