#[non_exhaustive]pub struct Update {
pub update_id: i64,
pub kind: UpdateKind,
}Expand description
This object represents an incoming update.
Corresponds to the Bot API Update object.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.update_id: i64The update’s unique identifier. Update identifiers start from a certain positive number and increase sequentially.
kind: UpdateKindThe payload carried by the update.
Implementations§
Source§impl Update
impl Update
Sourcepub fn message(&self) -> Option<&Message>
pub fn message(&self) -> Option<&Message>
Returns the message payload for message-like update kinds.
Sourcepub fn edited_message(&self) -> Option<&Message>
pub fn edited_message(&self) -> Option<&Message>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn channel_post(&self) -> Option<&Message>
pub fn channel_post(&self) -> Option<&Message>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn edited_channel_post(&self) -> Option<&Message>
pub fn edited_channel_post(&self) -> Option<&Message>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn business_connection(&self) -> Option<&BusinessConnection>
pub fn business_connection(&self) -> Option<&BusinessConnection>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn business_message(&self) -> Option<&Message>
pub fn business_message(&self) -> Option<&Message>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn edited_business_message(&self) -> Option<&Message>
pub fn edited_business_message(&self) -> Option<&Message>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn deleted_business_messages(&self) -> Option<&BusinessMessagesDeleted>
pub fn deleted_business_messages(&self) -> Option<&BusinessMessagesDeleted>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn inline_query(&self) -> Option<&InlineQuery>
pub fn inline_query(&self) -> Option<&InlineQuery>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn chosen_inline_result(&self) -> Option<&ChosenInlineResult>
pub fn chosen_inline_result(&self) -> Option<&ChosenInlineResult>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn callback_query(&self) -> Option<&CallbackQuery>
pub fn callback_query(&self) -> Option<&CallbackQuery>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn shipping_query(&self) -> Option<&ShippingQuery>
pub fn shipping_query(&self) -> Option<&ShippingQuery>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn pre_checkout_query(&self) -> Option<&PreCheckoutQuery>
pub fn pre_checkout_query(&self) -> Option<&PreCheckoutQuery>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn purchased_paid_media(&self) -> Option<&PaidMediaPurchased>
pub fn purchased_paid_media(&self) -> Option<&PaidMediaPurchased>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn poll(&self) -> Option<&Poll>
pub fn poll(&self) -> Option<&Poll>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn poll_answer(&self) -> Option<&PollAnswer>
pub fn poll_answer(&self) -> Option<&PollAnswer>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn my_chat_member(&self) -> Option<&ChatMemberUpdated>
pub fn my_chat_member(&self) -> Option<&ChatMemberUpdated>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn chat_member(&self) -> Option<&ChatMemberUpdated>
pub fn chat_member(&self) -> Option<&ChatMemberUpdated>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn chat_join_request(&self) -> Option<&ChatJoinRequest>
pub fn chat_join_request(&self) -> Option<&ChatJoinRequest>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn chat_boost(&self) -> Option<&ChatBoostUpdated>
pub fn chat_boost(&self) -> Option<&ChatBoostUpdated>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn removed_chat_boost(&self) -> Option<&ChatBoostRemoved>
pub fn removed_chat_boost(&self) -> Option<&ChatBoostRemoved>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn message_reaction(&self) -> Option<&MessageReactionUpdated>
pub fn message_reaction(&self) -> Option<&MessageReactionUpdated>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn message_reaction_count(&self) -> Option<&MessageReactionCountUpdated>
pub fn message_reaction_count(&self) -> Option<&MessageReactionCountUpdated>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn managed_bot(&self) -> Option<&ManagedBotUpdated>
pub fn managed_bot(&self) -> Option<&ManagedBotUpdated>
Returns the payload if this update is of the corresponding variant.
Sourcepub fn effective_user(&self) -> Option<&User>
pub fn effective_user(&self) -> Option<&User>
Returns a reference to the User that sent this update, regardless of update type.
Returns None for updates that have no associated user (channel posts, polls, chat
boosts, removed chat boosts, message reaction count, deleted business messages).
Mirrors Python’s Update.effective_user property.
Sourcepub fn effective_chat(&self) -> Option<&Chat>
pub fn effective_chat(&self) -> Option<&Chat>
Returns a reference to the Chat in which this update occurred, if any.
Returns None for updates with no associated chat (inline queries, chosen inline
results, shipping/pre-checkout queries, polls, poll answers, business connections,
purchased paid media, managed bot updates).
Mirrors Python’s Update.effective_chat property.
Sourcepub fn effective_message(&self) -> Option<&Message>
pub fn effective_message(&self) -> Option<&Message>
Returns a reference to the Message carried by this update, if any.
Considers message, edited_message, channel_post, edited_channel_post,
the message inside callback_query, business_message, and
edited_business_message.
For callback queries where the message is inaccessible (date == 0), this returns None
for the callback query branch.
Mirrors Python’s Update.effective_message property.