pub struct CallbackQuery {
pub query_id: i64,
pub user_id: i64,
pub message_id: Option<i32>,
pub chat_instance: i64,
pub data_raw: Option<Vec<u8>>,
pub game_short_name: Option<String>,
pub chat_peer: Option<Peer>,
pub inline_msg_id: Option<InputBotInlineMessageId>,
/* private fields */
}Expand description
A user pressed an inline keyboard button on a bot message.
Fields§
§query_id: i64§user_id: i64§message_id: Option<i32>§chat_instance: i64§data_raw: Option<Vec<u8>>Raw data bytes from the button.
game_short_name: Option<String>Game short name (if a game button was pressed).
chat_peer: Option<Peer>The peer (chat/channel/user) where the button was pressed.
None for inline-message callback queries.
inline_msg_id: Option<InputBotInlineMessageId>For inline-message callbacks: the message ID token.
Implementations§
Source§impl CallbackQuery
impl CallbackQuery
Sourcepub fn is_answered(&self) -> bool
pub fn is_answered(&self) -> bool
Whether an answer has already been sent for this callback query (by this handler or another one matching the same update).
Sourcepub fn chat_id(&self) -> i64
pub fn chat_id(&self) -> i64
The bare numeric chat ID the button press happened in.
0 for inline-message callback queries (chat_peer is None in
that case; the button is attached to a message sent via inline mode,
which has no ordinary chat peer). Used to build the FSM
crate::fsm::StateKey for crate::filters::Router::on_callback_query_fsm.
Sourcepub fn answer(&self) -> Answer<'_>
pub fn answer(&self) -> Answer<'_>
Begin building an answer for this callback query.
Finish with .send(&client).await. Telegram only accepts one
messages.setBotCallbackAnswer per query_id; if this query has
already been answered (by this handler or another matching handler),
send() skips the network call, logs a warning, and returns Ok(())
instead of surfacing a Telegram API error.
query.answer().text("Done!").send(&client).await?;
query.answer().alert("No permission!").send(&client).await?;
query.answer().url("https://example.com/game").send(&client).await?;
query.answer()
.text("Cached")
.cache_time(std::time::Duration::from_secs(60))
.send(&client).await?;Trait Implementations§
Source§impl Clone for CallbackQuery
impl Clone for CallbackQuery
Source§fn clone(&self) -> CallbackQuery
fn clone(&self) -> CallbackQuery
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for CallbackQuery
impl Debug for CallbackQuery
Source§impl MessageLike for CallbackQuery
Available on crate feature fsm only.
impl MessageLike for CallbackQuery
fsm only.