Skip to main content

Update

Struct Update 

Source
pub struct Update {
Show 28 fields pub update_id: i64, pub message: Option<Box<Message>>, pub edited_message: Option<Box<Message>>, pub channel_post: Option<Box<Message>>, pub edited_channel_post: Option<Box<Message>>, pub business_connection: Option<BusinessConnection>, pub business_message: Option<Box<Message>>, pub edited_business_message: Option<Box<Message>>, pub deleted_business_messages: Option<BusinessMessagesDeleted>, pub guest_message: Option<Box<Message>>, pub message_reaction: Option<MessageReactionUpdated>, pub message_reaction_count: Option<MessageReactionCountUpdated>, pub inline_query: Option<InlineQuery>, pub chosen_inline_result: Option<ChosenInlineResult>, pub callback_query: Option<CallbackQuery>, pub shipping_query: Option<ShippingQuery>, pub pre_checkout_query: Option<PreCheckoutQuery>, pub purchased_paid_media: Option<PaidMediaPurchased>, pub poll: Option<Poll>, pub poll_answer: Option<PollAnswer>, pub my_chat_member: Option<ChatMemberUpdated>, pub chat_member: Option<ChatMemberUpdated>, pub chat_join_request: Option<ChatJoinRequest>, pub chat_boost: Option<ChatBoostUpdated>, pub removed_chat_boost: Option<ChatBoostRemoved>, pub managed_bot: Option<ManagedBotUpdated>, pub subscription: Option<BotSubscriptionUpdated>, pub extra: BTreeMap<String, Value>,
}
Expand description

This object represents an incoming update.

Fields§

§update_id: i64

The update’s unique identifier. Update identifiers start from a certain positive number and increase sequentially. This identifier becomes especially handy if you’re using webhooks, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially.

§message: Option<Box<Message>>

New incoming message of any kind - text, photo, sticker, etc.

§edited_message: Option<Box<Message>>

New version of a message that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.

§channel_post: Option<Box<Message>>

New incoming channel post of any kind - text, photo, sticker, etc.

§edited_channel_post: Option<Box<Message>>

New version of a channel post that is known to the bot and was edited. This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.

§business_connection: Option<BusinessConnection>

The bot was connected to or disconnected from a business account, or a user edited an existing connection with the bot

§business_message: Option<Box<Message>>

New message from a connected business account

§edited_business_message: Option<Box<Message>>

New version of a message from a connected business account

§deleted_business_messages: Option<BusinessMessagesDeleted>

Messages were deleted from a connected business account

§guest_message: Option<Box<Message>>

New guest message. The bot can use the field Message.guest_query_id and the method answerGuestQuery to send a message in response.

§message_reaction: Option<MessageReactionUpdated>

A reaction to a message was changed by a user. The bot must be an administrator in the chat and must explicitly specify “message_reaction” in the list of allowed_updates to receive these updates. The update isn’t received for reactions set by bots.

§message_reaction_count: Option<MessageReactionCountUpdated>

Reactions to a message with anonymous reactions were changed. The bot must be an administrator in the chat and must explicitly specify “message_reaction_count” in the list of allowed_updates to receive these updates. The updates are grouped and can be sent with delay up to a few minutes.

§inline_query: Option<InlineQuery>

New incoming inline query

§chosen_inline_result: Option<ChosenInlineResult>

The result of an inline query that was chosen by a user and sent to their chat partner. Please see our documentation on the feedback collecting for details on how to enable these updates for your bot.

§callback_query: Option<CallbackQuery>

New incoming callback query

§shipping_query: Option<ShippingQuery>

New incoming shipping query. Only for invoices with flexible price.

§pre_checkout_query: Option<PreCheckoutQuery>

New incoming pre-checkout query. Contains full information about checkout.

§purchased_paid_media: Option<PaidMediaPurchased>

A user purchased paid media with a non-empty payload sent by the bot in a non-channel chat

§poll: Option<Poll>

New poll state. Bots receive only updates about manually stopped polls and polls, which are sent by the bot.

§poll_answer: Option<PollAnswer>

A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself.

§my_chat_member: Option<ChatMemberUpdated>

The bot’s chat member status was updated in a chat. For private chats, this update is received only when the bot is blocked or unblocked by the user.

§chat_member: Option<ChatMemberUpdated>

A chat member’s status was updated in a chat. The bot must be an administrator in the chat and must explicitly specify “chat_member” in the list of allowed_updates to receive these updates.

§chat_join_request: Option<ChatJoinRequest>

A request to join the chat has been sent. The bot must have the can_invite_users administrator right in the chat to receive these updates.

§chat_boost: Option<ChatBoostUpdated>

A chat boost was added or changed. The bot must be an administrator in the chat to receive these updates.

§removed_chat_boost: Option<ChatBoostRemoved>

A boost was removed from a chat. The bot must be an administrator in the chat to receive these updates.

§managed_bot: Option<ManagedBotUpdated>

A new bot was created to be managed by the bot, or token or owner of a managed bot was changed

§subscription: Option<BotSubscriptionUpdated>

User payment subscription has changed

§extra: BTreeMap<String, Value>

Implementations§

Source§

impl Update

Source

pub fn new(update_id: i64) -> Self

Source

pub fn message(self, value: Box<Message>) -> Self

Source

pub fn edited_message(self, value: Box<Message>) -> Self

Source

pub fn channel_post(self, value: Box<Message>) -> Self

Source

pub fn edited_channel_post(self, value: Box<Message>) -> Self

Source

pub fn business_connection(self, value: BusinessConnection) -> Self

Source

pub fn business_message(self, value: Box<Message>) -> Self

Source

pub fn edited_business_message(self, value: Box<Message>) -> Self

Source

pub fn deleted_business_messages(self, value: BusinessMessagesDeleted) -> Self

Source

pub fn guest_message(self, value: Box<Message>) -> Self

Source

pub fn message_reaction(self, value: MessageReactionUpdated) -> Self

Source

pub fn message_reaction_count(self, value: MessageReactionCountUpdated) -> Self

Source

pub fn inline_query(self, value: InlineQuery) -> Self

Source

pub fn chosen_inline_result(self, value: ChosenInlineResult) -> Self

Source

pub fn callback_query(self, value: CallbackQuery) -> Self

Source

pub fn shipping_query(self, value: ShippingQuery) -> Self

Source

pub fn pre_checkout_query(self, value: PreCheckoutQuery) -> Self

Source

pub fn purchased_paid_media(self, value: PaidMediaPurchased) -> Self

Source

pub fn poll(self, value: Poll) -> Self

Source

pub fn poll_answer(self, value: PollAnswer) -> Self

Source

pub fn my_chat_member(self, value: ChatMemberUpdated) -> Self

Source

pub fn chat_member(self, value: ChatMemberUpdated) -> Self

Source

pub fn chat_join_request(self, value: ChatJoinRequest) -> Self

Source

pub fn chat_boost(self, value: ChatBoostUpdated) -> Self

Source

pub fn removed_chat_boost(self, value: ChatBoostRemoved) -> Self

Source

pub fn managed_bot(self, value: ManagedBotUpdated) -> Self

Source

pub fn subscription(self, value: BotSubscriptionUpdated) -> Self

Source§

impl Update

Source

pub fn event(&self) -> Option<UpdateEventRef<'_>>

Returns the first known update payload using aiogram’s precedence.

Source

pub fn event_type(&self) -> Option<&'static str>

Returns the Telegram update field that contains the current event.

Source

pub fn message_event(&self) -> Option<&Message>

Returns the message-like payload for all message update variants.

Trait Implementations§

Source§

impl Clone for Update

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Update

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<'de> Deserialize<'de> for Update

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl PartialEq for Update

Source§

fn eq(&self, other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl Serialize for Update

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl StructuralPartialEq for Update

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self> ⓘ

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self> ⓘ

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Sized + Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> ⓘ
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self> ⓘ

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more