telegram_bot_raw_ars/types/update.rs
1use crate::types::*;
2
3/// This object represents an incoming update.
4#[derive(Debug, Clone, PartialEq, PartialOrd, Deserialize)]
5pub struct Update {
6 /// The update‘s unique identifier. Update identifiers start from a certain
7 /// positive number and increase sequentially.
8 #[serde(rename = "update_id")]
9 pub id: Integer,
10 /// Kind of the incoming update.
11 #[serde(flatten)]
12 pub kind: Option<UpdateKind>,
13}
14
15/// Kind of the incoming update.
16#[derive(Debug, Clone, PartialEq, PartialOrd, Deserialize)]
17pub enum UpdateKind {
18 /// New incoming message of any kind — text, photo, sticker, etc.
19 #[serde(rename = "message")]
20 Message(Message),
21 /// New version of a message that is known to the bot and was edited
22 #[serde(rename = "edited_message")]
23 EditedMessage(Message),
24 /// New incoming channel post of any kind — text, photo, sticker, etc.
25 #[serde(rename = "channel_post")]
26 ChannelPost(ChannelPost),
27 /// New version of a channel post that is known to the bot and was edited
28 #[serde(rename = "edited_channel_post")]
29 EditedChannelPost(ChannelPost),
30 #[serde(rename = "inline_query")]
31 InlineQuery(InlineQuery),
32 /// 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.
33 #[serde(rename = "chosen_inline_result")]
34 ChosenInlineResult(ChosenInlineResult),
35 #[serde(rename = "callback_query")]
36 CallbackQuery(CallbackQuery),
37 /// New incoming shipping query. Only for invoices with flexible price
38 #[serde(rename = "shipping_query")]
39 ShippingQuery(ShippingQuery),
40 /// New incoming pre-checkout query. Contains full information about checkout
41 #[serde(rename = "pre_checkout_query")]
42 PreCheckoutQuery(PreCheckoutQuery),
43 /// New poll state. Bots receive only updates about stopped polls and polls, which are sent by the bot
44 #[serde(rename = "poll")]
45 Poll(Poll),
46 /// A user changed their answer in a non-anonymous poll. Bots receive new votes only in polls that were sent by the bot itself
47 #[serde(rename = "poll_answer")]
48 PollAnswer(PollAnswer),
49 /// 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.
50 #[serde(rename = "my_chat_member")]
51 MyChatMember(ChatMemberUpdate),
52 /// 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.
53 #[serde(rename = "chat_member")]
54 ChatMember(ChatMemberUpdate),
55 #[doc(hidden)]
56 Error(String),
57 #[doc(hidden)]
58 Unknown,
59}