telegram_bot2/models/mod.rs
1#![allow(dead_code)]
2
3use crate::models::reply_markup::InlineKeyboardMarkup;
4use crate::Builder;
5use passport::PassportData;
6use serde::{Deserialize, Serialize};
7
8mod action;
9mod chat_id;
10mod chat_member;
11mod command_scope;
12mod inline;
13mod input_media;
14mod menu;
15mod passport;
16mod reply_markup;
17mod sent_file;
18mod updates;
19
20pub use action::*;
21pub use chat_id::*;
22pub use chat_member::*;
23pub use command_scope::*;
24pub use inline::*;
25pub use input_media::*;
26pub use menu::*;
27pub use passport::*;
28pub use reply_markup::*;
29pub use sent_file::*;
30pub use updates::*;
31
32#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
33/// This object represents a Telegram user or bot
34pub struct User {
35 /// Unique identifier for this user or bot. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit i64 or double-precision f32 type are safe for storing this identifier.
36 pub id: i64,
37 /// True, if this user is a bot
38 pub is_bot: bool,
39 /// User's or bot's first name
40 pub first_name: String,
41 /// User's or bot's last name
42 #[serde(default, skip_serializing_if = "Option::is_none")]
43 pub last_name: Option<String>,
44 /// User's or bot's username
45 #[serde(default, skip_serializing_if = "Option::is_none")]
46 pub username: Option<String>,
47 /// IETF language tag of the user's language
48 #[serde(default, skip_serializing_if = "Option::is_none")]
49 pub language_code: Option<String>,
50 /// True, if this user is a Telegram Premium user
51 #[serde(default, skip_serializing_if = "Option::is_none")]
52 pub is_premium: Option<bool>,
53 /// True, if this user added the bot to the attachment menu
54 #[serde(default, skip_serializing_if = "Option::is_none")]
55 pub added_to_attachment_menu: Option<bool>,
56 /// True, if the bot can be invited to groups. Returned only in getMe.
57 #[serde(default, skip_serializing_if = "Option::is_none")]
58 pub can_join_groups: Option<bool>,
59 /// True, if privacy mode is disabled for the bot. Returned only in getMe.
60 #[serde(default, skip_serializing_if = "Option::is_none")]
61 pub can_read_all_group_messages: Option<bool>,
62 /// True, if the bot supports inline queries. Returned only in getMe.
63 #[serde(default, skip_serializing_if = "Option::is_none")]
64 pub supports_inline_queries: Option<bool>,
65}
66
67#[derive(Serialize, Deserialize, Clone, Debug)]
68#[serde(rename_all = "snake_case")]
69#[allow(missing_docs)]
70pub enum ChatType {
71 Private,
72 Group,
73 SuperGroup,
74 Channel,
75}
76
77/// This object represents a chat.
78#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
79pub struct Chat {
80 /// Unique identifier for this chat. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit i64 or double-precision f32 type are safe for storing this identifier.
81 pub id: i64,
82 /// Type of chat, can be either “private”, “group”, “supergroup” or “channel”
83 #[serde(alias = "type")]
84 pub _type: ChatType,
85 /// Title, for supergroups, channels and group chats
86 #[serde(default, skip_serializing_if = "Option::is_none")]
87 pub title: Option<String>,
88 /// Username, for private chats, supergroups and channels if available
89 #[serde(default, skip_serializing_if = "Option::is_none")]
90 pub username: Option<String>,
91 /// First name of the other party in a private chat
92 #[serde(default, skip_serializing_if = "Option::is_none")]
93 pub first_name: Option<String>,
94 /// Last name of the other party in a private chat
95 #[serde(default, skip_serializing_if = "Option::is_none")]
96 pub last_name: Option<String>,
97 /// If the supergroup chat is a forum (has topics enabled)
98 #[serde(default, skip_serializing_if = "Option::is_none")]
99 pub is_forum: Option<bool>,
100 /// Chat photo. Returned only in getChat.
101 #[serde(default, skip_serializing_if = "Option::is_none")]
102 pub photo: Option<ChatPhoto>,
103 /// If non-empty, the list of all active chat usernames; for private chats, supergroups and channels. Returned only in [`get_chat`][crate::Bot::get_chat]
104 #[serde(default, skip_serializing_if = "Vec::is_empty")]
105 active_usernames: Vec<String>,
106 /// Custom emoji identifier of emoji status of the other party in a private chat. Returned only in [`get_chat`][crate::Bot::get_chat]
107 #[serde(default, skip_serializing_if = "Option::is_none")]
108 emoji_status_custom_emoji_id: Option<String>,
109 /// Bio of the other party in a private chat. Returned only in getChat.
110 #[serde(default, skip_serializing_if = "Option::is_none")]
111 pub bio: Option<String>,
112 /// True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user. Returned only in getChat.
113 #[serde(default, skip_serializing_if = "Option::is_none")]
114 pub has_private_forwards: Option<bool>,
115 /// True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. Returned only in getChat.
116 #[serde(default, skip_serializing_if = "Option::is_none")]
117 pub has_restricted_voice_and_video_messages: Option<bool>,
118 /// True, if users need to join the supergroup before they can send messages. Returned only in getChat.
119 #[serde(default, skip_serializing_if = "Option::is_none")]
120 pub join_to_send_messages: Option<bool>,
121 /// True, if all users directly joining the supergroup need to be approved by supergroup administrators. Returned only in getChat.
122 #[serde(default, skip_serializing_if = "Option::is_none")]
123 pub join_by_request: Option<bool>,
124 /// Description, for groups, supergroups and channel chats. Returned only in getChat.
125 #[serde(default, skip_serializing_if = "Option::is_none")]
126 pub description: Option<String>,
127 /// Primary invite link, for groups, supergroups and channel chats. Returned only in getChat.
128 #[serde(default, skip_serializing_if = "Option::is_none")]
129 pub invite_link: Option<String>,
130 /// The most recent pinned message (by sending date). Returned only in getChat.
131 #[serde(default, skip_serializing_if = "Option::is_none")]
132 pub pinned_message: Option<Box<Message>>,
133 /// Default chat member permissions, for groups and supergroups. Returned only in getChat.
134 #[serde(default, skip_serializing_if = "Option::is_none")]
135 pub permissions: Option<ChatPermissions>,
136 /// For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. Returned only in getChat.
137 #[serde(default, skip_serializing_if = "Option::is_none")]
138 pub slow_mode_delay: Option<i64>,
139 /// The time after which all messages sent to the chat will be automatically deleted; in seconds. Returned only in getChat.
140 #[serde(default, skip_serializing_if = "Option::is_none")]
141 pub message_auto_delete_time: Option<i64>,
142 /// True, if aggressive anti-spam checks are enabled in the supergroup. The field is only available to chat administrators. Returned only in [getChat](Bot::get_chat)
143 #[serde(default, skip_serializing_if = "Option::is_none")]
144 pub has_aggressive_anti_spam_enabled: Option<bool>,
145 /// True, if messages from the chat can't be forwarded to other chats. Returned only in getChat.
146 /// True, if non-administrators can only get the list of bots and administrators in the chat. Returned only in [getChat](Bot::get_chat)
147 #[serde(default, skip_serializing_if = "Option::is_none")]
148 pub has_hidden_members: Option<bool>,
149 /// True, if messages from the chat can't be forwarded to other chats. Returned only in getChat.
150 #[serde(default, skip_serializing_if = "Option::is_none")]
151 pub has_protected_content: Option<bool>,
152 /// For supergroups, name of group sticker set. Returned only in getChat.
153 #[serde(default, skip_serializing_if = "Option::is_none")]
154 pub sticker_set_name: Option<String>,
155 /// True, if the bot can change the group sticker set. Returned only in getChat.
156 #[serde(default, skip_serializing_if = "Option::is_none")]
157 pub can_set_sticker_set: Option<bool>,
158 /// Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. But it is smaller than 52 bits, so a signed 64 bit i64 or double-precision f32 type are safe for storing this identifier. Returned only in getChat.
159 #[serde(default, skip_serializing_if = "Option::is_none")]
160 pub linked_chat_id: Option<i64>,
161 /// For supergroups, the location to which the supergroup is connected. Returned only in getChat.
162 #[serde(default, skip_serializing_if = "Option::is_none")]
163 pub location: Option<ChatLocation>,
164}
165
166/// This object represents a message.
167#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
168pub struct Message {
169 /// Unique message identifier inside this chat
170 pub message_id: i64,
171 /// Unique identifier of a message thread to which the message belongs; for supergroups only
172 #[serde(default, skip_serializing_if = "Option::is_none")]
173 pub message_thread_id: Option<i64>,
174 /// Sender of the message; empty for messages sent to channels. For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
175 #[serde(default, skip_serializing_if = "Option::is_none")]
176 pub from: Option<User>,
177 /// Sender of the message, sent on behalf of a chat. For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group. For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
178 #[serde(default, skip_serializing_if = "Option::is_none")]
179 pub sender_chat: Option<Box<Chat>>,
180 /// Date the message was sent in Unix time
181 pub date: i64,
182 /// Conversation the message belongs to
183 pub chat: Chat,
184 /// For forwarded messages, sender of the original message
185 #[serde(default, skip_serializing_if = "Option::is_none")]
186 pub forward_from: Option<User>,
187 /// For messages forwarded from channels or from anonymous administrators, information about the original sender chat
188 #[serde(default, skip_serializing_if = "Option::is_none")]
189 pub forward_from_chat: Option<Box<Chat>>,
190 /// For messages forwarded from channels, identifier of the original message in the channel
191 #[serde(default, skip_serializing_if = "Option::is_none")]
192 pub forward_from_message_id: Option<i64>,
193 /// For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present
194 #[serde(default, skip_serializing_if = "Option::is_none")]
195 pub forward_signature: Option<String>,
196 /// Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages
197 #[serde(default, skip_serializing_if = "Option::is_none")]
198 pub forward_sender_name: Option<String>,
199 /// For forwarded messages, date the original message was sent in Unix time
200 #[serde(default, skip_serializing_if = "Option::is_none")]
201 pub forward_date: Option<i64>,
202 /// If the message is sent to a forum topic
203 #[serde(default, skip_serializing_if = "Option::is_none")]
204 pub is_topic_message: Option<i64>,
205 /// True, if the message is a channel post that was automatically forwarded to the connected discussion group
206 #[serde(default, skip_serializing_if = "Option::is_none")]
207 pub is_automatic_forward: Option<bool>,
208 /// For replies, the original message. Note that the Message object in this field will not contain further reply_to_message fields even if it itself is a reply.
209 #[serde(default, skip_serializing_if = "Option::is_none")]
210 pub reply_to_message: Option<Box<Message>>,
211 /// Bot through which the message was sent
212 #[serde(default, skip_serializing_if = "Option::is_none")]
213 pub via_bot: Option<User>,
214 /// Date the message was last edited in Unix time
215 #[serde(default, skip_serializing_if = "Option::is_none")]
216 pub edit_date: Option<i64>,
217 /// True, if the message can't be forwarded
218 #[serde(default, skip_serializing_if = "Option::is_none")]
219 pub has_protected_content: Option<bool>,
220 /// The unique identifier of a media message group this message belongs to
221 #[serde(default, skip_serializing_if = "Option::is_none")]
222 pub media_group_id: Option<String>,
223 /// Signature of the post author for messages in channels, or the custom title of an anonymous group administrator
224 #[serde(default, skip_serializing_if = "Option::is_none")]
225 pub author_signature: Option<String>,
226 /// For text messages, the actual UTF-8 text of the message
227 #[serde(default, skip_serializing_if = "Option::is_none")]
228 pub text: Option<String>,
229 /// For text messages, special entities like usernames, URLs, bot commands, etc. that appear in the text
230 #[serde(default, skip_serializing_if = "Vec::is_empty")]
231 pub entities: Vec<MessageEntity>,
232 /// Message is an animation, information about the animation. For backward compatibility, when this field is set, the document field will also be set
233 #[serde(default, skip_serializing_if = "Option::is_none")]
234 pub animation: Option<Animation>,
235 /// Message is an audio file, information about the file
236 #[serde(default, skip_serializing_if = "Option::is_none")]
237 pub audio: Option<Audio>,
238 /// Message is a general file, information about the file
239 #[serde(default, skip_serializing_if = "Option::is_none")]
240 pub document: Option<Document>,
241 /// Message is a photo, available sizes of the photo
242 #[serde(default, skip_serializing_if = "Vec::is_empty")]
243 pub photo: Vec<PhotoSize>,
244 /// Message is a sticker, information about the sticker
245 #[serde(default, skip_serializing_if = "Option::is_none")]
246 pub sticker: Option<Sticker>,
247 /// Message is a video, information about the video
248 #[serde(default, skip_serializing_if = "Option::is_none")]
249 pub video: Option<Video>,
250 /// Message is a video note, information about the video message
251 #[serde(default, skip_serializing_if = "Option::is_none")]
252 pub video_note: Option<VideoNote>,
253 /// Message is a voice message, information about the file
254 #[serde(default, skip_serializing_if = "Option::is_none")]
255 pub voice: Option<Voice>,
256 /// Caption for the animation, audio, document, photo, video or voice
257 #[serde(default, skip_serializing_if = "Option::is_none")]
258 pub caption: Option<String>,
259 /// For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
260 #[serde(default, skip_serializing_if = "Vec::is_empty")]
261 pub caption_entities: Vec<MessageEntity>,
262 /// True, if the message media is covered by a spoiler animation
263 #[serde(default, skip_serializing_if = "Option::is_none")]
264 pub has_media_spoiler: Option<bool>,
265 /// Message is a shared contact, information about the contact
266 #[serde(default, skip_serializing_if = "Option::is_none")]
267 pub contact: Option<Contact>,
268 /// Message is a dice with random value
269 #[serde(default, skip_serializing_if = "Option::is_none")]
270 pub dice: Option<Dice>,
271 /// Message is a game, information about the game. More about games »
272 #[serde(default, skip_serializing_if = "Option::is_none")]
273 pub game: Option<Game>,
274 /// Message is a native poll, information about the poll
275 #[serde(default, skip_serializing_if = "Option::is_none")]
276 pub poll: Option<Poll>,
277 /// Message is a venue, information about the venue. For backward compatibility, when this field is set, the location field will also be set
278 #[serde(default, skip_serializing_if = "Option::is_none")]
279 pub venue: Option<Venue>,
280 /// Message is a shared location, information about the location
281 #[serde(default, skip_serializing_if = "Option::is_none")]
282 pub location: Option<Location>,
283 /// New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
284 #[serde(default, skip_serializing_if = "Vec::is_empty")]
285 pub new_chat_members: Vec<User>,
286 /// A member was removed from the group, information about them (this member may be the bot itself)
287 #[serde(default, skip_serializing_if = "Option::is_none")]
288 pub left_chat_member: Option<User>,
289 /// A chat title was changed to this value
290 #[serde(default, skip_serializing_if = "Option::is_none")]
291 pub new_chat_title: Option<String>,
292 /// A chat photo was change to this value
293 #[serde(default, skip_serializing_if = "Vec::is_empty")]
294 pub new_chat_photo: Vec<PhotoSize>,
295 /// Service message: the chat photo was deleted
296 #[serde(default, skip_serializing_if = "Option::is_none")]
297 pub delete_chat_photo: Option<bool>,
298 /// Service message: the group has been created
299 #[serde(default, skip_serializing_if = "Option::is_none")]
300 pub group_chat_created: Option<bool>,
301 /// Service message: the supergroup has been created. This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created. It can only be found in reply_to_message if someone replies to a very first message in a directly created supergroup.
302 #[serde(default, skip_serializing_if = "Option::is_none")]
303 pub supergroup_chat_created: Option<bool>,
304 /// Service message: the channel has been created. This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created. It can only be found in reply_to_message if someone replies to a very first message in a channel.
305 #[serde(default, skip_serializing_if = "Option::is_none")]
306 pub channel_chat_created: Option<bool>,
307 /// Service message: auto-delete timer settings changed in the chat
308 #[serde(default, skip_serializing_if = "Option::is_none")]
309 pub message_auto_delete_timer_changed: Option<MessageAutoDeleteTimerChanged>,
310 /// The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit i64 or double-precision f32 type are safe for storing this identifier.
311 #[serde(default, skip_serializing_if = "Option::is_none")]
312 pub migrate_to_chat_id: Option<i64>,
313 /// The supergroup has been migrated from a group with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit i64 or double-precision f32 type are safe for storing this identifier.
314 #[serde(default, skip_serializing_if = "Option::is_none")]
315 pub migrate_from_chat_id: Option<i64>,
316 /// Specified message was pinned. Note that the Message object in this field will not contain further reply_to_message fields even if it is itself a reply.
317 #[serde(default, skip_serializing_if = "Option::is_none")]
318 pub pinned_message: Option<Box<Message>>,
319 /// Message is an invoice for a payment, information about the invoice. More about payments »
320 #[serde(default, skip_serializing_if = "Option::is_none")]
321 pub invoice: Option<Invoice>,
322 /// Message is a service message about a successful payment, information about the payment. More about payments »
323 #[serde(default, skip_serializing_if = "Option::is_none")]
324 pub successful_payment: Option<SuccessfulPayment>,
325 /// The domain name of the website on which the user has logged in. More about Telegram Login »
326 #[serde(default, skip_serializing_if = "Option::is_none")]
327 pub connected_website: Option<String>,
328 /// Service message: the user allowed the bot added to the attachment menu to write messages
329 #[serde(default, skip_serializing_if = "Option::is_none")]
330 pub write_access_allowed: Option<WriteAccessAllowed>,
331 /// Telegram Passport data
332 #[serde(default, skip_serializing_if = "Option::is_none")]
333 pub passport_data: Option<PassportData>,
334 /// Service message. A user in the chat triggered another user's proximity alert while sharing Live Location.
335 #[serde(default, skip_serializing_if = "Option::is_none")]
336 pub proximity_alert_triggered: Option<ProximityAlertTriggered>,
337 /// Service message: forum topic created
338 #[serde(default, skip_serializing_if = "Option::is_none")]
339 pub forum_topic_created: Option<ForumTopicCreated>,
340 /// Service message: forum topic edited
341 #[serde(default, skip_serializing_if = "Option::is_none")]
342 pub forum_topic_edited: Option<ForumTopicEdited>,
343 /// Service message: forum topic closed
344 #[serde(default, skip_serializing_if = "Option::is_none")]
345 pub forum_topic_closed: Option<ForumTopicClosed>,
346 /// Service message: forum topic reopened
347 #[serde(default, skip_serializing_if = "Option::is_none")]
348 pub forum_topic_reopened: Option<ForumTopicReopened>,
349 /// Service message: the 'General' forum topic hidden
350 #[serde(default, skip_serializing_if = "Option::is_none")]
351 pub general_forum_topic_hidden: Option<GeneralForumTopicHidden>,
352 /// Service message: the 'General' forum topic unhidden
353 #[serde(default, skip_serializing_if = "Option::is_none")]
354 pub general_forum_topic_unhidden: Option<GeneralForumTopicUnhidden>,
355 /// Service message: video chat scheduled
356 #[serde(default, skip_serializing_if = "Option::is_none")]
357 pub video_chat_scheduled: Option<VideoChatScheduled>,
358 /// Service message: video chat started
359 #[serde(default, skip_serializing_if = "Option::is_none")]
360 pub video_chat_started: Option<VideoChatStarted>,
361 /// Service message: video chat ended
362 #[serde(default, skip_serializing_if = "Option::is_none")]
363 pub video_chat_ended: Option<VideoChatEnded>,
364 /// Service message: new participants invited to a video chat
365 #[serde(default, skip_serializing_if = "Option::is_none")]
366 pub video_chat_participants_invited: Option<VideoChatParticipantsInvited>,
367 /// Service message: data sent by a Web App
368 #[serde(default, skip_serializing_if = "Option::is_none")]
369 pub web_app_data: Option<WebAppData>,
370 /// Inline keyboard attached to the message. login_url buttons are represented as ordinary Url buttons.
371 #[serde(default, skip_serializing_if = "Option::is_none")]
372 pub reply_markup: Option<InlineKeyboardMarkup>,
373}
374
375/// This object represents a unique message identifier.
376#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
377pub struct MessageId {
378 /// Unique message identifier
379 pub message_id: i64,
380}
381
382#[derive(Serialize, Deserialize, Clone, Debug)]
383#[serde(rename_all = "snake_case", tag = "type")]
384#[allow(missing_docs)]
385pub enum MessageEntityType {
386 Mention,
387 Hashtag,
388 CashTag,
389 BotCommand,
390 Url,
391 Email,
392 PhoneNumber,
393 Bold,
394 Italic,
395 Underline,
396 Strikethrough,
397 Spoiler,
398 Code,
399 Pre,
400 TextLink {
401 url: String,
402 },
403 TextMention {
404 user: User,
405 },
406 CustomEmoji {
407 #[serde(rename = "custom_emoji_id")]
408 id: String,
409 },
410}
411
412/// This object represents one special entity in a text message. For example, hashtags, usernames, URLs, etc.
413#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
414pub struct MessageEntity {
415 /// Type of the entity
416 #[serde(flatten)]
417 pub _type: MessageEntityType,
418 /// Offset in UTF-16 code units to the start of the entity
419 pub offset: i64,
420 /// Length of the entity in UTF-16 code units
421 pub length: i64,
422}
423
424/// This object represents one size of a photo or a file / sticker thumbnail.
425#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
426pub struct PhotoSize {
427 /// Identifier for this file, which can be used to download or reuse the file
428 pub file_id: String,
429 /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
430 pub file_unique_id: String,
431 /// Photo width
432 pub width: i64,
433 /// Photo height
434 pub height: i64,
435 /// File size in bytes
436 #[serde(default, skip_serializing_if = "Option::is_none")]
437 pub file_size: Option<i64>,
438}
439
440/// This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound).
441#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
442pub struct Animation {
443 /// Identifier for this file, which can be used to download or reuse the file
444 pub file_id: String,
445 /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
446 pub file_unique_id: String,
447 /// Video width as defined by sender
448 pub width: i64,
449 /// Video height as defined by sender
450 pub height: i64,
451 /// Duration of the video in seconds as defined by sender
452 pub duration: i64,
453 /// Animation thumbnail as defined by sender
454 #[serde(default, skip_serializing_if = "Option::is_none")]
455 pub thumb: Option<PhotoSize>,
456 /// Original animation filename as defined by sender
457 #[serde(default, skip_serializing_if = "Option::is_none")]
458 pub file_name: Option<String>,
459 /// MIME type of the file as defined by sender
460 #[serde(default, skip_serializing_if = "Option::is_none")]
461 pub mime_type: Option<String>,
462 /// File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit i64 or double-precision f32 type are safe for storing this value.
463 #[serde(default, skip_serializing_if = "Option::is_none")]
464 pub file_size: Option<i64>,
465}
466
467/// This object represents an audio file to be treated as music by the Telegram clients.
468#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
469pub struct Audio {
470 /// Identifier for this file, which can be used to download or reuse the file
471 pub file_id: String,
472 /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
473 pub file_unique_id: String,
474 /// Duration of the audio in seconds as defined by sender
475 pub duration: i64,
476 /// Performer of the audio as defined by sender or by audio tags
477 #[serde(default, skip_serializing_if = "Option::is_none")]
478 pub performer: Option<String>,
479 /// Title of the audio as defined by sender or by audio tags
480 #[serde(default, skip_serializing_if = "Option::is_none")]
481 pub title: Option<String>,
482 /// Original filename as defined by sender
483 #[serde(default, skip_serializing_if = "Option::is_none")]
484 pub file_name: Option<String>,
485 /// MIME type of the file as defined by sender
486 #[serde(default, skip_serializing_if = "Option::is_none")]
487 pub mime_type: Option<String>,
488 /// File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit i64 or double-precision f32 type are safe for storing this value.
489 #[serde(default, skip_serializing_if = "Option::is_none")]
490 pub file_size: Option<i64>,
491 /// Thumbnail of the album cover to which the music file belongs
492 #[serde(default, skip_serializing_if = "Option::is_none")]
493 pub thumb: Option<PhotoSize>,
494}
495
496/// This object represents a general file (as opposed to photos, voice messages and audio files).
497#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
498pub struct Document {
499 /// Identifier for this file, which can be used to download or reuse the file
500 pub file_id: String,
501 /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
502 pub file_unique_id: String,
503 /// Document thumbnail as defined by sender
504 #[serde(default, skip_serializing_if = "Option::is_none")]
505 pub thumb: Option<PhotoSize>,
506 /// Original filename as defined by sender
507 #[serde(default, skip_serializing_if = "Option::is_none")]
508 pub file_name: Option<String>,
509 /// MIME type of the file as defined by sender
510 #[serde(default, skip_serializing_if = "Option::is_none")]
511 pub mime_type: Option<String>,
512 /// File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit i64 or double-precision f32 type are safe for storing this value.
513 #[serde(default, skip_serializing_if = "Option::is_none")]
514 pub file_size: Option<i64>,
515}
516
517/// This object represents a video file.
518#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
519pub struct Video {
520 /// Identifier for this file, which can be used to download or reuse the file
521 pub file_id: String,
522 /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
523 pub file_unique_id: String,
524 /// Video width as defined by sender
525 pub width: i64,
526 /// Video height as defined by sender
527 pub height: i64,
528 /// Duration of the video in seconds as defined by sender
529 pub duration: i64,
530 /// Video thumbnail
531 #[serde(default, skip_serializing_if = "Option::is_none")]
532 pub thumb: Option<PhotoSize>,
533 /// Original filename as defined by sender
534 #[serde(default, skip_serializing_if = "Option::is_none")]
535 pub file_name: Option<String>,
536 /// MIME type of the file as defined by sender
537 #[serde(default, skip_serializing_if = "Option::is_none")]
538 pub mime_type: Option<String>,
539 /// File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit i64 or double-precision f32 type are safe for storing this value.
540 #[serde(default, skip_serializing_if = "Option::is_none")]
541 pub file_size: Option<i64>,
542}
543
544/// This object represents a video message (available in Telegram apps as of v.4.0).
545#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
546pub struct VideoNote {
547 /// Identifier for this file, which can be used to download or reuse the file
548 pub file_id: String,
549 /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
550 pub file_unique_id: String,
551 /// Video width and height (diameter of the video message) as defined by sender
552 pub length: i64,
553 /// Duration of the video in seconds as defined by sender
554 pub duration: i64,
555 /// Video thumbnail
556 #[serde(default, skip_serializing_if = "Option::is_none")]
557 pub thumb: Option<PhotoSize>,
558 /// File size in bytes
559 #[serde(default, skip_serializing_if = "Option::is_none")]
560 pub file_size: Option<i64>,
561}
562
563/// This object represents a voice note.
564#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
565pub struct Voice {
566 /// Identifier for this file, which can be used to download or reuse the file
567 pub file_id: String,
568 /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
569 pub file_unique_id: String,
570 /// Duration of the audio in seconds as defined by sender
571 pub duration: i64,
572 /// MIME type of the file as defined by sender
573 #[serde(default, skip_serializing_if = "Option::is_none")]
574 pub mime_type: Option<String>,
575 /// File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit i64 or double-precision f32 type are safe for storing this value.
576 #[serde(default, skip_serializing_if = "Option::is_none")]
577 pub file_size: Option<i64>,
578}
579
580/// This object represents a phone contact.
581#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
582pub struct Contact {
583 /// Contact's phone number
584 pub phone_number: String,
585 /// Contact's first name
586 pub first_name: String,
587 /// Contact's last name
588 #[serde(default, skip_serializing_if = "Option::is_none")]
589 pub last_name: Option<String>,
590 /// Contact's user identifier in Telegram. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a 64-bit i64 or double-precision f32 type are safe for storing this identifier.
591 #[serde(default, skip_serializing_if = "Option::is_none")]
592 pub user_id: Option<i64>,
593 /// Additional data about the contact in the form of a vCard
594 #[serde(default, skip_serializing_if = "Option::is_none")]
595 pub vcard: Option<String>,
596}
597
598/// This object represents an animated emoji that displays a random value.
599#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
600pub struct Dice {
601 /// Emoji on which the dice throw animation is based
602 pub emoji: String,
603 /// Value of the dice, 1-6 for “🎲”, “🎯” and “🎳” base emoji, 1-5 for “🏀” and “⚽” base emoji, 1-64 for “🎰” base emoji
604 pub value: i64,
605}
606
607/// This object contains information about one answer option in a poll.
608#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
609pub struct PollOption {
610 /// Option text, 1-100 characters
611 pub text: String,
612 /// Number of users that voted for this option
613 pub voter_count: i64,
614}
615
616/// This object represents an answer of a user in a non-anonymous poll.
617#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
618pub struct PollAnswer {
619 /// Unique poll identifier
620 pub poll_id: String,
621 /// The user, who changed the answer to the poll
622 pub user: User,
623 /// 0-based identifiers of answer options, chosen by the user. May be empty if the user retracted their vote.
624 #[serde(default, skip_serializing_if = "Vec::is_empty")]
625 pub option_ids: Vec<i64>,
626}
627
628#[derive(Serialize, Deserialize, Clone, Debug)]
629#[serde(rename_all = "snake_case")]
630#[allow(missing_docs)]
631pub enum PollType {
632 Regular,
633 Quiz,
634}
635
636/// This object contains information about a poll.
637#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
638pub struct Poll {
639 /// Unique poll identifier
640 pub id: String,
641 /// Poll question, 1-300 characters
642 pub question: String,
643 /// List of poll options
644 #[serde(skip_serializing_if = "Vec::is_empty")]
645 pub options: Vec<PollOption>,
646 /// Total number of users that voted in the poll
647 pub total_voter_count: i64,
648 /// True, if the poll is closed
649 pub is_closed: bool,
650 /// True, if the poll is anonymous
651 pub is_anonymous: bool,
652 /// Poll type, currently can be “regular” or “quiz”
653 #[serde(alias = "type")]
654 pub _type: PollType,
655 /// True, if the poll allows multiple answers
656 pub allows_multiple_answers: bool,
657 /// 0-based identifier of the correct answer option. Available only for polls in the quiz mode, which are closed, or was sent (not forwarded) by the bot or to the private chat with the bot.
658 #[serde(default, skip_serializing_if = "Option::is_none")]
659 pub correct_option_id: Option<i64>,
660 /// Text that is shown when a user chooses an incorrect answer or taps on the lamp icon in a quiz-style poll, 0-200 characters
661 #[serde(default, skip_serializing_if = "Option::is_none")]
662 pub explanation: Option<String>,
663 /// Special entities like usernames, URLs, bot commands, etc. that appear in the explanation
664 #[serde(default, skip_serializing_if = "Vec::is_empty")]
665 pub explanation_entities: Vec<MessageEntity>,
666 /// Amount of time in seconds the poll will be active after creation
667 #[serde(default, skip_serializing_if = "Option::is_none")]
668 pub open_period: Option<i64>,
669 /// Point in time (Unix timestamp) when the poll will be automatically closed
670 #[serde(default, skip_serializing_if = "Option::is_none")]
671 pub close_date: Option<i64>,
672}
673
674/// This object represents a point on the map.
675#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
676pub struct Location {
677 /// Longitude as defined by sender
678 pub longitude: f32,
679 /// Latitude as defined by sender
680 pub latitude: f32,
681 /// The radius of uncertainty for the location, measured in meters; 0-1500
682 pub horizontal_accuracy: f32,
683 /// Time relative to the message sending date, during which the location can be updated; in seconds. For active live locations only.
684 #[serde(default, skip_serializing_if = "Option::is_none")]
685 pub live_period: Option<i64>,
686 /// The direction in which user is moving, in degrees; 1-360. For active live locations only.
687 #[serde(default, skip_serializing_if = "Option::is_none")]
688 pub heading: Option<i64>,
689 /// The maximum distance for proximity alerts about approaching another chat member, in meters. For sent live locations only.
690 #[serde(default, skip_serializing_if = "Option::is_none")]
691 pub proximity_alert_radius: Option<i64>,
692}
693
694/// This object represents a venue.
695#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
696pub struct Venue {
697 /// Venue location. Can't be a live location
698 pub location: Location,
699 /// Name of the venue
700 pub title: String,
701 /// Address of the venue
702 pub address: String,
703 /// Foursquare identifier of the venue
704 #[serde(default, skip_serializing_if = "Option::is_none")]
705 pub foursquare_id: Option<String>,
706 /// Foursquare type of the venue. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
707 #[serde(default, skip_serializing_if = "Option::is_none")]
708 pub foursquare_type: Option<String>,
709 /// Google Places identifier of the venue
710 #[serde(default, skip_serializing_if = "Option::is_none")]
711 pub google_place_id: Option<String>,
712 /// Google Places type of the venue. (See supported types.)
713 #[serde(default, skip_serializing_if = "Option::is_none")]
714 pub google_place_type: Option<String>,
715}
716
717/// Describes data sent from a Web App to the bot.
718#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
719pub struct WebAppData {
720 /// The data. Be aware that a bad client can send arbitrary data in this field.
721 pub data: String,
722 /// Text of the web_app keyboard button from which the Web App was opened. Be aware that a bad client can send arbitrary data in this field.
723 pub button_text: String,
724}
725
726/// This object represents the content of a service message, sent whenever a user in the chat triggers a proximity alert set by another user.
727#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
728pub struct ProximityAlertTriggered {
729 /// User that triggered the alert
730 pub traveler: User,
731 /// User that set the alert
732 pub watcher: User,
733 /// The distance between the users
734 pub distance: i64,
735}
736
737/// This object represents a service message about a change in auto-delete timer settings.
738#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
739pub struct MessageAutoDeleteTimerChanged {
740 /// New auto-delete time for messages in the chat; in seconds
741 pub message_auto_delete_time: i64,
742}
743
744/// This object represents a service message about a video chat scheduled in the chat.
745#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
746pub struct VideoChatScheduled {
747 /// Point in time (Unix timestamp) when the video chat is supposed to be started by a chat administrator
748 pub start_date: i64,
749}
750
751/// This object represents a service message about a video chat started in the chat. Currently holds no information.
752#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
753pub struct VideoChatStarted {}
754
755/// This object represents a service message about a video chat ended in the chat.
756#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
757pub struct VideoChatEnded {
758 /// Video chat duration in seconds
759 pub duration: i64,
760}
761
762/// This object represents a service message about new members invited to a video chat.
763#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
764pub struct VideoChatParticipantsInvited {
765 /// New members that were invited to the video chat
766 #[serde(default, skip_serializing_if = "Vec::is_empty")]
767 pub users: Vec<User>,
768}
769
770/// This object represent a user's profile pictures.
771#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
772pub struct UserProfilePhotos {
773 /// Total number of profile pictures the target user has
774 pub total_count: i64,
775 /// Requested profile pictures (in up to 4 sizes each)
776 #[serde(default, skip_serializing_if = "Vec::is_empty")]
777 pub photos: Vec<PhotoSize>,
778}
779
780/// This object represents a file ready to be downloaded. The file can be downloaded via the link `https://api.telegram.org/file/bot<token>/<file_path>`. It is guaranteed that the link will be valid for at least 1 hour. When the link expires, a new one can be requested by calling getFile.
781#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
782pub struct File {
783 /// Identifier for this file, which can be used to download or reuse the file
784 pub file_id: String,
785 /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
786 pub file_unique_id: String,
787 /// File size in bytes. It can be bigger than 2^31 and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit i64 or double-precision f32 type are safe for storing this value.
788 #[serde(default, skip_serializing_if = "Option::is_none")]
789 pub file_size: Option<i64>,
790 /// File path. Use `https://api.telegram.org/file/bot<token>/<file_path>` to get the file.
791 #[serde(default, skip_serializing_if = "Option::is_none")]
792 pub file_path: Option<String>,
793}
794
795/// Describes a Web App.
796#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
797pub struct WebAppInfo {
798 /// An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps
799 pub url: String,
800}
801
802/// This object represents a chat photo.
803#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
804pub struct ChatPhoto {
805 /// File identifier of small (160x160) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.
806 pub small_file_id: String,
807 /// Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
808 pub small_file_unique_id: String,
809 /// File identifier of big (640x640) chat photo. This file_id can be used only for photo download and only for as long as the photo is not changed.
810 pub big_file_id: String,
811 /// Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
812 pub big_file_unique_id: String,
813}
814
815/// Represents an invite link for a chat.
816#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
817pub struct ChatInviteLink {
818 /// The invite link. If the link was created by another chat administrator, then the second part of the link will be replaced with “…”.
819 pub invite_link: String,
820 /// Creator of the link
821 pub creator: User,
822 /// True, if users joining the chat via the link need to be approved by chat administrators
823 pub creates_join_request: bool,
824 /// True, if the link is primary
825 pub is_primary: bool,
826 /// True, if the link is revoked
827 pub is_revoked: bool,
828 /// Invite link name
829 #[serde(default, skip_serializing_if = "Option::is_none")]
830 pub name: Option<String>,
831 /// Point in time (Unix timestamp) when the link will expire or has been expired
832 #[serde(default, skip_serializing_if = "Option::is_none")]
833 pub expire_date: Option<i64>,
834 /// The maximum number of users that can be members of the chat simultaneously after joining the chat via this invite link; 1-99999
835 #[serde(default, skip_serializing_if = "Option::is_none")]
836 pub member_limit: Option<i64>,
837 /// Number of pending join requests created using this link
838 #[serde(default, skip_serializing_if = "Option::is_none")]
839 pub pending_join_request_count: Option<i64>,
840}
841
842/// Represents the rights of an administrator in a chat.
843#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
844pub struct ChatAdministratorRights {
845 /// True, if the user's presence in the chat is hidden
846 pub is_anonymous: bool,
847 /// True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege
848 pub can_manage_chat: bool,
849 /// True, if the administrator can delete messages of other users
850 pub can_delete_messages: bool,
851 /// True, if the administrator can manage video chats
852 pub can_manage_video_chats: bool,
853 /// True, if the administrator can restrict, ban or unban chat members
854 pub can_restrict_members: bool,
855 /// True, if the administrator can add new administrators with a subset of their own privileges or demote administrators that he has promoted, directly or indirectly (promoted by administrators that were appointed by the user)
856 pub can_promote_members: bool,
857 /// True, if the user is allowed to change the chat title, photo and other settings
858 pub can_change_info: bool,
859 /// True, if the user is allowed to invite new users to the chat
860 pub can_invite_users: bool,
861 /// True, if the administrator can post in the channel; channels only
862 #[serde(default, skip_serializing_if = "Option::is_none")]
863 pub can_post_messages: Option<bool>,
864 /// True, if the administrator can edit messages of other users and can pin messages; channels only
865 #[serde(default, skip_serializing_if = "Option::is_none")]
866 pub can_edit_messages: Option<bool>,
867 /// True, if the user is allowed to pin messages; groups and supergroups only
868 #[serde(default, skip_serializing_if = "Option::is_none")]
869 pub can_pin_messages: Option<bool>,
870 /// If the user is allowed to create, rename, close, and reopen forum topics; supergroups only
871 #[serde(default, skip_serializing_if = "Option::is_none")]
872 pub can_manage_topics: Option<bool>,
873}
874
875/// Represents a join request sent to a chat.
876#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
877pub struct ChatJoinRequest {
878 /// Chat to which the request was sent
879 pub chat: Chat,
880 /// User that sent the join request
881 pub from: User,
882 /// Date the request was sent in Unix time
883 pub date: i64,
884 /// Bio of the user.
885 #[serde(default, skip_serializing_if = "Option::is_none")]
886 pub bio: Option<String>,
887 /// Chat invite link that was used by the user to send the join request
888 #[serde(default, skip_serializing_if = "Option::is_none")]
889 pub invite_link: Option<ChatInviteLink>,
890}
891
892/// Describes actions that a non-administrator user is allowed to take in a chat.
893#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
894pub struct ChatPermissions {
895 /// True, if the user is allowed to send text messages, contacts, locations and venues
896 #[serde(default, skip_serializing_if = "Option::is_none")]
897 pub can_send_messages: Option<bool>,
898 /// True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages
899 #[serde(default, skip_serializing_if = "Option::is_none")]
900 pub can_send_media_messages: Option<bool>,
901 /// True, if the user is allowed to send polls, implies can_send_messages
902 #[serde(default, skip_serializing_if = "Option::is_none")]
903 pub can_send_polls: Option<bool>,
904 /// True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages
905 #[serde(default, skip_serializing_if = "Option::is_none")]
906 pub can_send_other_messages: Option<bool>,
907 /// True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages
908 #[serde(default, skip_serializing_if = "Option::is_none")]
909 pub can_add_web_page_previews: Option<bool>,
910 /// True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups
911 #[serde(default, skip_serializing_if = "Option::is_none")]
912 pub can_change_info: Option<bool>,
913 /// True, if the user is allowed to invite new users to the chat
914 #[serde(default, skip_serializing_if = "Option::is_none")]
915 pub can_invite_users: Option<bool>,
916 /// True, if the user is allowed to pin messages. Ignored in public supergroups
917 #[serde(default, skip_serializing_if = "Option::is_none")]
918 pub can_pin_messages: Option<bool>,
919 /// If the user is allowed to create, rename, close, and reopen forum topics; supergroups only
920 #[serde(default, skip_serializing_if = "Option::is_none")]
921 pub can_manage_topics: Option<bool>,
922}
923
924/// Represents a location to which a chat is connected.
925#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
926pub struct ChatLocation {
927 /// The location to which the supergroup is connected. Can't be a live location.
928 pub location: Location,
929 /// Location address; 1-64 characters, as defined by the chat owner
930 pub address: String,
931}
932
933/// This object represents a bot command.
934#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
935pub struct BotCommand {
936 /// Text of the command; 1-32 characters. Can contain only lowercase English letters, digits and underscores.
937 pub command: String,
938 /// Description of the command; 1-256 characters.
939 pub description: String,
940}
941
942/// BotCommandScopeDefault
943
944/// If a menu button other than MenuButtonDefault is set for a private chat, then it is applied in the chat. Otherwise the default menu button is applied. By default, the menu button opens the list of bot commands.
945
946/// Describes why a request was unsuccessful.
947#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
948pub struct ResponseParameters {
949 /// The group has been migrated to a supergroup with the specified identifier. This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it. But it has at most 52 significant bits, so a signed 64-bit i64 or double-precision f32 type are safe for storing this identifier.
950 #[serde(default, skip_serializing_if = "Option::is_none")]
951 pub migrate_to_chat_id: Option<i64>,
952 /// In case of exceeding flood control, the number of seconds left to wait before the request can be repeated
953 #[serde(default, skip_serializing_if = "Option::is_none")]
954 pub retry_after: Option<i64>,
955}
956
957#[derive(Serialize, Deserialize, Clone, Debug)]
958#[serde(rename_all = "lowercase")]
959#[allow(missing_docs)]
960pub enum StickerType {
961 Regular,
962 Mask,
963 CustomEmoji,
964}
965
966/// This object represents a sticker
967#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
968pub struct Sticker {
969 /// Identifier for this file, which can be used to download or reuse the file
970 pub file_id: String,
971 /// Unique identifier for this file, which is supposed to be the same over time and for different bots. Can't be used to download or reuse the file.
972 pub file_unique_id: String,
973 /// Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”. The type of the sticker is independent from its format, which is determined by the fields is_animated and is_video.
974 #[serde(rename = "type")]
975 pub _type: StickerType,
976 /// Sticker width
977 pub width: i64,
978 /// Sticker height
979 pub height: i64,
980 /// True, if the sticker is animated
981 pub is_animated: bool,
982 /// True, if the sticker is a video sticker
983 pub is_video: bool,
984 /// Sticker thumbnail in the .WEBP or .JPG format
985 #[serde(default, skip_serializing_if = "Option::is_none")]
986 pub thumb: Option<PhotoSize>,
987 /// Emoji associated with the sticker
988 #[serde(default, skip_serializing_if = "Option::is_none")]
989 pub emoji: Option<String>,
990 /// Name of the sticker set to which the sticker belongs
991 #[serde(default, skip_serializing_if = "Option::is_none")]
992 pub set_name: Option<String>,
993 /// For premium regular stickers, premium animation for the sticker
994 #[serde(default, skip_serializing_if = "Option::is_none")]
995 pub premium_animation: Option<File>,
996 /// For mask stickers, the position where the mask should be placed
997 #[serde(default, skip_serializing_if = "Option::is_none")]
998 pub mask_position: Option<MaskPosition>,
999 /// For custom emoji stickers, unique identifier of the custom emoji
1000 #[serde(default, skip_serializing_if = "Option::is_none")]
1001 pub custom_emoji_id: Option<String>,
1002 /// File size in bytes
1003 #[serde(default, skip_serializing_if = "Option::is_none")]
1004 pub file_size: Option<i64>,
1005}
1006
1007/// This object represents a sticker set
1008#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1009pub struct StickerSet {
1010 /// Sticker set name
1011 pub name: String,
1012 /// Sticker set title
1013 pub title: String,
1014 /// Type of stickers in the set, currently one of “regular”, “mask”, “custom_emoji”
1015 pub sticker_type: String,
1016 /// True, if the sticker set contains animated stickers
1017 pub is_animated: bool,
1018 /// True, if the sticker set contains video stickers
1019 pub is_video: bool,
1020 /// List of all set stickers
1021 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1022 pub stickers: Vec<Sticker>,
1023 /// Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
1024 #[serde(default, skip_serializing_if = "Option::is_none")]
1025 pub thumb: Option<PhotoSize>,
1026}
1027
1028/// This object describes the position on faces where a mask should be placed by default
1029#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1030pub struct MaskPosition {
1031 /// The part of the face relative to which the mask should be placed. One of “forehead”, “eyes”, “mouth”, or “chin”.
1032 pub point: String,
1033 /// Shift by X-axis measured in widths of the mask scaled to the face size, from left to right. For example, choosing -1.0 will place mask just to the left of the default mask position.
1034 pub x_shift: f32,
1035 /// Shift by Y-axis measured in heights of the mask scaled to the face size, from top to bottom. For example, 1.0 will place the mask just below the default mask position.
1036 pub y_shift: f32,
1037 /// Mask scaling coefficient. For example, 2.0 means double size.
1038 pub scale: f32,
1039}
1040
1041/// This object represents a portion of the price for goods or services.
1042#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1043pub struct LabeledPrice {
1044 /// Portion label
1045 pub label: String,
1046 /// Price of the product in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
1047 pub amount: i64,
1048}
1049
1050/// This object contains basic information about an invoice.
1051#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1052pub struct Invoice {
1053 /// Product name
1054 pub title: String,
1055 /// Product description
1056 pub description: String,
1057 /// Unique bot deep-linking parameter that can be used to generate this invoice
1058 pub start_parameter: String,
1059 /// Three-letter ISO 4217 currency code
1060 pub currency: String,
1061 /// Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
1062 pub total_amount: i64,
1063}
1064
1065/// This object represents a shipping address.
1066#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1067pub struct ShippingAddress {
1068 /// Two-letter ISO 3166-1 alpha-2 country code
1069 pub country_code: String,
1070 /// State, if applicable
1071 pub state: String,
1072 /// City
1073 pub city: String,
1074 /// First line for the address
1075 pub street_line1: String,
1076 /// Second line for the address
1077 pub street_line2: String,
1078 /// Address post code
1079 pub post_code: String,
1080}
1081
1082/// This object represents information about an order.
1083#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1084pub struct OrderInfo {
1085 /// User name
1086 #[serde(default, skip_serializing_if = "Option::is_none")]
1087 pub name: Option<String>,
1088 /// User's phone number
1089 #[serde(default, skip_serializing_if = "Option::is_none")]
1090 pub phone_number: Option<String>,
1091 /// User email
1092 #[serde(default, skip_serializing_if = "Option::is_none")]
1093 pub email: Option<String>,
1094 /// User shipping address
1095 #[serde(default, skip_serializing_if = "Option::is_none")]
1096 pub shipping_address: Option<ShippingAddress>,
1097}
1098
1099/// This object represents one shipping option.
1100#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1101pub struct ShippingOption {
1102 /// Shipping option identifier
1103 pub id: String,
1104 /// Option title
1105 pub title: String,
1106 /// List of price portions
1107 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1108 pub prices: Vec<LabeledPrice>,
1109}
1110
1111/// This object contains basic information about a successful payment.
1112#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1113pub struct SuccessfulPayment {
1114 /// Three-letter ISO 4217 currency code
1115 pub currency: String,
1116 /// Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
1117 pub total_amount: i64,
1118 /// Bot specified invoice payload
1119 pub invoice_payload: String,
1120 /// Identifier of the shipping option chosen by the user
1121 #[serde(default, skip_serializing_if = "Option::is_none")]
1122 pub shipping_option_id: Option<String>,
1123 /// Order information provided by the user
1124 #[serde(default, skip_serializing_if = "Option::is_none")]
1125 pub order_info: Option<OrderInfo>,
1126 /// Telegram payment identifier
1127 pub telegram_payment_charge_id: String,
1128 /// Provider payment identifier
1129 pub provider_payment_charge_id: String,
1130}
1131
1132/// This object contains information about an incoming shipping query.
1133#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1134pub struct ShippingQuery {
1135 /// Unique query identifier
1136 pub id: String,
1137 /// User who sent the query
1138 pub from: User,
1139 /// Bot specified invoice payload
1140 pub invoice_payload: String,
1141 /// User specified shipping address
1142 pub shipping_address: ShippingAddress,
1143}
1144
1145/// This object contains information about an incoming pre-checkout query.
1146#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1147pub struct PreCheckoutQuery {
1148 /// Unique query identifier
1149 pub id: String,
1150 /// User who sent the query
1151 pub from: User,
1152 /// Three-letter ISO 4217 currency code
1153 pub currency: String,
1154 /// Total price in the smallest units of the currency (integer, not float/double). For example, for a price of US$ 1.45 pass amount = 145. See the exp parameter in currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies).
1155 pub total_amount: i64,
1156 /// Bot specified invoice payload
1157 pub invoice_payload: String,
1158 /// Identifier of the shipping option chosen by the user
1159 #[serde(default, skip_serializing_if = "Option::is_none")]
1160 pub shipping_option_id: Option<String>,
1161 /// Order information provided by the user
1162 #[serde(default, skip_serializing_if = "Option::is_none")]
1163 pub order_info: Option<OrderInfo>,
1164}
1165
1166/// This object represents a game. Use BotFather to create and edit games, their short names will act as unique identifiers.
1167#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1168pub struct Game {
1169 /// Title of the game
1170 pub title: String,
1171 /// Description of the game
1172 pub description: String,
1173 /// Photo that will be displayed in the game message in chats.
1174 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1175 pub photo: Vec<PhotoSize>,
1176 /// Brief description of the game or high scores included in the game message.Can be automatically edited to include current high scores for the game when the bot calls setGameScore, or manually edited using editMessageText.0 - 4096 characters
1177 #[serde(default, skip_serializing_if = "Option::is_none")]
1178 pub text: Option<String>,
1179 /// Special entities that appear in text, such as usernames, URLs, bot commands, etc.
1180 #[serde(default, skip_serializing_if = "Vec::is_empty")]
1181 pub text_entities: Vec<MessageEntity>,
1182 /// Animation that will be displayed in the game message in chats.Upload via BotFather
1183 #[serde(default, skip_serializing_if = "Option::is_none")]
1184 pub animation: Option<Animation>,
1185}
1186
1187/// A placeholder, currently holds no information. Use BotFather to set up your game.
1188type CallbackGame = ();
1189
1190/// This object represents one row of the high scores table for a game.
1191#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1192pub struct GameHighScore {
1193 /// Position in high score table for the game
1194 pub position: i64,
1195 /// User
1196 pub user: User,
1197 /// Score
1198 pub score: i64,
1199}
1200
1201/// This object represents a service message about a new forum topic created in the chat
1202#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1203pub struct ForumTopicCreated {
1204 /// Name of the topic
1205 name: String,
1206 /// Color of the topic icon in RGB format
1207 icon_color: i64,
1208 /// Unique identifier of the custom emoji shown as the topic icon
1209 icon_custom_emoji_id: Option<String>,
1210}
1211
1212/// This object represents a service message about a forum topic closed in the chat. Currently holds no information
1213#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1214pub struct ForumTopicClosed {}
1215
1216/// This object represents a service message about a forum topic reopened in the chat. Currently holds no information
1217#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1218pub struct ForumTopicReopened {}
1219
1220/// This object represents a service message about an edited forum topicF
1221#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1222pub struct ForumTopicEdited {
1223 /// New name of the topic, if it was edited
1224 #[serde(default, skip_serializing_if = "Option::is_none")]
1225 pub name: Option<String>,
1226 /// New identifier of the custom emoji shown as the topic icon, if it was edited; an empty string if the icon was removed
1227 #[serde(default, skip_serializing_if = "Option::is_none")]
1228 pub icon_custom_emoji_id: Option<String>,
1229}
1230
1231/// This object represents a service message about General forum topic hidden in the chat. Currently holds no information
1232#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1233pub struct GeneralForumTopicHidden {}
1234
1235/// This object represents a service message about General forum topic unhidden in the chat. Currently holds no information
1236#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1237pub struct GeneralForumTopicUnhidden {}
1238
1239/// This object represents a service message about a user allowing a bot added to the attachment menu to write messages. Currently holds no information
1240#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
1241pub struct WriteAccessAllowed {}