telegram_bot2/models/inline.rs
1use crate::models::{InlineKeyboardMarkup, LabeledPrice, Location, MessageEntity, User};
2use crate::Builder;
3use serde::{Deserialize, Serialize};
4
5/// This object represents an incoming inline query. When the user sends an empty query, your bot could return some default or trending results.
6#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
7pub struct InlineQuery {
8 /// Unique identifier for this query
9 pub id: String,
10 /// Sender
11 pub from: User,
12 /// Text of the query (up to 256 characters)
13 pub query: String,
14 /// Offset of the results to be returned, can be controlled by the bot
15 pub offset: String,
16 /// Type of the chat from which the inline query was sent.Can be either “sender” for a private chat with the inline query sender, “private”, “group”, “supergroup”, or “channel”.The chat type should be always known for requests sent from official clients and most third - party clients, unless the request was sent from a secret chat
17 #[serde(default, skip_serializing_if = "Option::is_none")]
18 chat_type: Option<String>,
19 /// Sender location, only for bots that request user location
20 #[serde(default, skip_serializing_if = "Option::is_none")]
21 location: Option<Location>,
22}
23
24#[derive(Serialize, Deserialize, Clone, Debug)]
25#[serde(rename_all = "snake_case", tag = "type")]
26/// This object represents one result of an inline query. Telegram clients currently support results of the following 20 types:
27pub enum InlineQueryResult {
28 /// Represents a link to an article or web page.
29 Article {
30 /// Unique identifier for this result, 1-64 Bytes
31 id: String,
32 /// Title of the result
33 title: String,
34 /// Content of the message to be sent
35 input_message_content: InputMessageContent,
36 /// Inline keyboard attached to the message
37 #[serde(default, skip_serializing_if = "Option::is_none")]
38 reply_markup: Option<InlineKeyboardMarkup>,
39 /// URL of the result
40 #[serde(default, skip_serializing_if = "Option::is_none")]
41 url: Option<String>,
42 /// Pass True if you don't want the URL to be shown in the message
43 #[serde(default, skip_serializing_if = "Option::is_none")]
44 hide_url: Option<bool>,
45 /// Short description of the result
46 #[serde(default, skip_serializing_if = "Option::is_none")]
47 description: Option<String>,
48 /// Url of the thumbnail for the result
49 #[serde(default, skip_serializing_if = "Option::is_none")]
50 thumb_url: Option<String>,
51 /// Thumbnail width
52 #[serde(default, skip_serializing_if = "Option::is_none")]
53 thumb_width: Option<i64>,
54 /// Thumbnail height
55 #[serde(default, skip_serializing_if = "Option::is_none")]
56 thumb_height: Option<i64>,
57 },
58
59 /// Represents a link to a photo. By default, this photo will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
60 #[serde(rename = "photo")]
61 CachedPhoto {
62 /// Unique identifier for this result, 1-64 bytes
63 id: String,
64 /// A valid URL of the photo. Photo must be in JPEG format. Photo size must not exceed 5MB
65 photo_url: String,
66 /// URL of the thumbnail for the photo
67 thumb_url: String,
68 /// Width of the photo
69 #[serde(default, skip_serializing_if = "Option::is_none")]
70 photo_width: Option<i64>,
71 /// Height of the photo
72 #[serde(default, skip_serializing_if = "Option::is_none")]
73 photo_height: Option<i64>,
74 /// Title for the result
75 #[serde(default, skip_serializing_if = "Option::is_none")]
76 title: Option<String>,
77 /// Short description of the result
78 #[serde(default, skip_serializing_if = "Option::is_none")]
79 description: Option<String>,
80 /// Caption of the photo to be sent, 0-1024 characters after entities parsing
81 #[serde(default, skip_serializing_if = "Option::is_none")]
82 caption: Option<String>,
83 /// Mode for parsing entities in the photo caption. See formatting options for more details.
84 #[serde(default, skip_serializing_if = "Option::is_none")]
85 parse_mode: Option<String>,
86 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
87 #[serde(default, skip_serializing_if = "Vec::is_empty")]
88 caption_entities: Vec<MessageEntity>,
89 /// Inline keyboard attached to the message
90 #[serde(default, skip_serializing_if = "Option::is_none")]
91 reply_markup: Option<InlineKeyboardMarkup>,
92 /// Content of the message to be sent instead of the photo
93 #[serde(default, skip_serializing_if = "Option::is_none")]
94 input_message_content: Option<InputMessageContent>,
95 },
96
97 /// Represents a link to an animated GIF file. By default, this animated GIF file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
98 #[serde(rename = "gif")]
99 CachedGif {
100 /// Unique identifier for this result, 1-64 bytes
101 id: String,
102 /// A valid URL for the GIF file. File size must not exceed 1MB
103 gif_url: String,
104 /// Width of the GIF
105 #[serde(default, skip_serializing_if = "Option::is_none")]
106 gif_width: Option<i64>,
107 /// Height of the GIF
108 #[serde(default, skip_serializing_if = "Option::is_none")]
109 gif_height: Option<i64>,
110 /// Duration of the GIF in seconds
111 #[serde(default, skip_serializing_if = "Option::is_none")]
112 gif_duration: Option<i64>,
113 /// URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
114 thumb_url: String,
115 /// MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”
116 #[serde(default, skip_serializing_if = "Option::is_none")]
117 thumb_mime_type: Option<String>,
118 /// Title for the result
119 #[serde(default, skip_serializing_if = "Option::is_none")]
120 title: Option<String>,
121 /// Caption of the GIF file to be sent, 0-1024 characters after entities parsing
122 #[serde(default, skip_serializing_if = "Option::is_none")]
123 caption: Option<String>,
124 /// Mode for parsing entities in the caption. See formatting options for more details.
125 #[serde(default, skip_serializing_if = "Option::is_none")]
126 parse_mode: Option<String>,
127 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
128 #[serde(default, skip_serializing_if = "Vec::is_empty")]
129 caption_entities: Vec<MessageEntity>,
130 /// Inline keyboard attached to the message
131 #[serde(default, skip_serializing_if = "Option::is_none")]
132 reply_markup: Option<InlineKeyboardMarkup>,
133 /// Content of the message to be sent instead of the GIF animation
134 #[serde(default, skip_serializing_if = "Option::is_none")]
135 input_message_content: Option<InputMessageContent>,
136 },
137
138 /// Represents a link to a video animation (H.264/MPEG-4 AVC video without sound). By default, this animated MPEG-4 file will be sent by the user with optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
139 #[serde(rename = "mpeg4_gif")]
140 CachedMpeg4Gif {
141 /// Unique identifier for this result, 1-64 bytes
142 id: String,
143 /// A valid URL for the MPEG4 file. File size must not exceed 1MB
144 mpeg4_url: String,
145 /// Video width
146 #[serde(default, skip_serializing_if = "Option::is_none")]
147 mpeg4_width: Option<i64>,
148 /// Video height
149 #[serde(default, skip_serializing_if = "Option::is_none")]
150 mpeg4_height: Option<i64>,
151 /// Video duration in seconds
152 #[serde(default, skip_serializing_if = "Option::is_none")]
153 mpeg4_duration: Option<i64>,
154 /// URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
155 thumb_url: String,
156 /// MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”. Defaults to “image/jpeg”
157 #[serde(default, skip_serializing_if = "Option::is_none")]
158 thumb_mime_type: Option<String>,
159 /// Title for the result
160 #[serde(default, skip_serializing_if = "Option::is_none")]
161 title: Option<String>,
162 /// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing
163 #[serde(default, skip_serializing_if = "Option::is_none")]
164 caption: Option<String>,
165 /// Mode for parsing entities in the caption. See formatting options for more details.
166 #[serde(default, skip_serializing_if = "Option::is_none")]
167 parse_mode: Option<String>,
168 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
169 #[serde(default, skip_serializing_if = "Vec::is_empty")]
170 caption_entities: Vec<MessageEntity>,
171 /// Inline keyboard attached to the message
172 #[serde(default, skip_serializing_if = "Option::is_none")]
173 reply_markup: Option<InlineKeyboardMarkup>,
174 /// Content of the message to be sent instead of the video animation
175 #[serde(default, skip_serializing_if = "Option::is_none")]
176 input_message_content: Option<InputMessageContent>,
177 },
178
179 /// Represents a link to a page containing an embedded video player or a video file. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
180 /// If an InlineQueryResultVideo message contains an embedded video (e.g., YouTube), you must replace its content using input_message_content.
181 #[serde(rename = "video")]
182 CachedVideo {
183 /// Unique identifier for this result, 1-64 bytes
184 id: String,
185 /// A valid URL for the embedded video player or video file
186 video_url: String,
187 /// MIME type of the content of the video URL, “text/html” or “video/mp4”
188 mime_type: String,
189 /// URL of the thumbnail (JPEG only) for the video
190 thumb_url: String,
191 /// Title for the result
192 title: String,
193 /// Caption of the video to be sent, 0-1024 characters after entities parsing
194 #[serde(default, skip_serializing_if = "Option::is_none")]
195 caption: Option<String>,
196 /// Mode for parsing entities in the video caption. See formatting options for more details.
197 #[serde(default, skip_serializing_if = "Option::is_none")]
198 parse_mode: Option<String>,
199 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
200 #[serde(default, skip_serializing_if = "Vec::is_empty")]
201 caption_entities: Vec<MessageEntity>,
202 /// Video width
203 #[serde(default, skip_serializing_if = "Option::is_none")]
204 video_width: Option<i64>,
205 /// Video height
206 #[serde(default, skip_serializing_if = "Option::is_none")]
207 video_height: Option<i64>,
208 /// Video duration in seconds
209 #[serde(default, skip_serializing_if = "Option::is_none")]
210 video_duration: Option<i64>,
211 /// Short description of the result
212 #[serde(default, skip_serializing_if = "Option::is_none")]
213 description: Option<String>,
214 /// Inline keyboard attached to the message
215 #[serde(default, skip_serializing_if = "Option::is_none")]
216 reply_markup: Option<InlineKeyboardMarkup>,
217 /// Content of the message to be sent instead of the video. This field is required if InlineQueryResultVideo is used to send an HTML-page as a result (e.g., a YouTube video).
218 #[serde(default, skip_serializing_if = "Option::is_none")]
219 input_message_content: Option<InputMessageContent>,
220 },
221
222 /// Represents a link to an MP3 audio file. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
223 /// Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
224 #[serde(rename = "audio")]
225 CachedAudio {
226 /// Unique identifier for this result, 1-64 bytes
227 id: String,
228 /// A valid URL for the audio file
229 audio_url: String,
230 /// Title
231 title: String,
232 /// Caption, 0-1024 characters after entities parsing
233 #[serde(default, skip_serializing_if = "Option::is_none")]
234 caption: Option<String>,
235 /// Mode for parsing entities in the audio caption. See formatting options for more details.
236 #[serde(default, skip_serializing_if = "Option::is_none")]
237 parse_mode: Option<String>,
238 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
239 #[serde(default, skip_serializing_if = "Vec::is_empty")]
240 caption_entities: Vec<MessageEntity>,
241 /// Performer
242 #[serde(default, skip_serializing_if = "Option::is_none")]
243 performer: Option<String>,
244 /// Audio duration in seconds
245 #[serde(default, skip_serializing_if = "Option::is_none")]
246 audio_duration: Option<i64>,
247 /// Inline keyboard attached to the message
248 #[serde(default, skip_serializing_if = "Option::is_none")]
249 reply_markup: Option<InlineKeyboardMarkup>,
250 /// Content of the message to be sent instead of the audio
251 #[serde(default, skip_serializing_if = "Option::is_none")]
252 input_message_content: Option<InputMessageContent>,
253 },
254
255 /// Represents a link to a voice recording in an .OGG container encoded with OPUS. By default, this voice recording will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the the voice message.
256 /// Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
257 #[serde(rename = "voice")]
258 CachedVoice {
259 /// Unique identifier for this result, 1-64 bytes
260 id: String,
261 /// A valid URL for the voice recording
262 voice_url: String,
263 /// Recording title
264 title: String,
265 /// Caption, 0-1024 characters after entities parsing
266 #[serde(default, skip_serializing_if = "Option::is_none")]
267 caption: Option<String>,
268 /// Mode for parsing entities in the voice message caption. See formatting options for more details.
269 #[serde(default, skip_serializing_if = "Option::is_none")]
270 parse_mode: Option<String>,
271 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
272 #[serde(default, skip_serializing_if = "Vec::is_empty")]
273 caption_entities: Vec<MessageEntity>,
274 /// Recording duration in seconds
275 #[serde(default, skip_serializing_if = "Option::is_none")]
276 voice_duration: Option<i64>,
277 /// Inline keyboard attached to the message
278 #[serde(default, skip_serializing_if = "Option::is_none")]
279 reply_markup: Option<InlineKeyboardMarkup>,
280 /// Content of the message to be sent instead of the voice recording
281 #[serde(default, skip_serializing_if = "Option::is_none")]
282 input_message_content: Option<InputMessageContent>,
283 },
284
285 /// Represents a link to a file. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file. Currently, only .PDF and .ZIP files can be sent using this method.
286 /// Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
287 #[serde(rename = "document")]
288 CachedDocument {
289 /// Unique identifier for this result, 1-64 bytes
290 id: String,
291 /// Title for the result
292 title: String,
293 /// Caption of the document to be sent, 0-1024 characters after entities parsing
294 #[serde(default, skip_serializing_if = "Option::is_none")]
295 caption: Option<String>,
296 /// Mode for parsing entities in the document caption. See formatting options for more details.
297 #[serde(default, skip_serializing_if = "Option::is_none")]
298 parse_mode: Option<String>,
299 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
300 #[serde(default, skip_serializing_if = "Vec::is_empty")]
301 caption_entities: Vec<MessageEntity>,
302 /// A valid URL for the file
303 document_url: String,
304 /// MIME type of the content of the file, either “application/pdf” or “application/zip”
305 mime_type: String,
306 /// Short description of the result
307 #[serde(default, skip_serializing_if = "Option::is_none")]
308 description: Option<String>,
309 /// Inline keyboard attached to the message
310 #[serde(default, skip_serializing_if = "Option::is_none")]
311 reply_markup: Option<InlineKeyboardMarkup>,
312 /// Content of the message to be sent instead of the file
313 #[serde(default, skip_serializing_if = "Option::is_none")]
314 input_message_content: Option<InputMessageContent>,
315 /// URL of the thumbnail (JPEG only) for the file
316 #[serde(default, skip_serializing_if = "Option::is_none")]
317 thumb_url: Option<String>,
318 /// Thumbnail width
319 #[serde(default, skip_serializing_if = "Option::is_none")]
320 thumb_width: Option<i64>,
321 /// Thumbnail height
322 #[serde(default, skip_serializing_if = "Option::is_none")]
323 thumb_height: Option<i64>,
324 },
325
326 /// Represents a location on a map. By default, the location will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the location.
327 /// Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
328 Location {
329 /// Unique identifier for this result, 1-64 Bytes
330 id: String,
331 /// Location latitude in degrees
332 latitude: f32,
333 /// Location longitude in degrees
334 longitude: f32,
335 /// Location title
336 title: String,
337 /// The radius of uncertainty for the location, measured in meters; 0-1500
338 #[serde(default, skip_serializing_if = "Option::is_none")]
339 horizontal_accuracy: Option<f32>,
340 /// Period in seconds for which the location can be updated, should be between 60 and 86400.
341 #[serde(default, skip_serializing_if = "Option::is_none")]
342 live_period: Option<i64>,
343 /// For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
344 #[serde(default, skip_serializing_if = "Option::is_none")]
345 heading: Option<i64>,
346 /// For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
347 #[serde(default, skip_serializing_if = "Option::is_none")]
348 proximity_alert_radius: Option<i64>,
349 /// Inline keyboard attached to the message
350 #[serde(default, skip_serializing_if = "Option::is_none")]
351 reply_markup: Option<InlineKeyboardMarkup>,
352 /// Content of the message to be sent instead of the location
353 #[serde(default, skip_serializing_if = "Option::is_none")]
354 input_message_content: Option<InputMessageContent>,
355 /// Url of the thumbnail for the result
356 #[serde(default, skip_serializing_if = "Option::is_none")]
357 thumb_url: Option<String>,
358 /// Thumbnail width
359 #[serde(default, skip_serializing_if = "Option::is_none")]
360 thumb_width: Option<i64>,
361 /// Thumbnail height
362 #[serde(default, skip_serializing_if = "Option::is_none")]
363 thumb_height: Option<i64>,
364 },
365
366 /// Represents a venue. By default, the venue will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the venue.
367 /// Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
368 Venue {
369 /// Unique identifier for this result, 1-64 Bytes
370 id: String,
371 /// Latitude of the venue location in degrees
372 latitude: f32,
373 /// Longitude of the venue location in degrees
374 longitude: f32,
375 /// Title of the venue
376 title: String,
377 /// Address of the venue
378 address: String,
379 /// Foursquare identifier of the venue if known
380 #[serde(default, skip_serializing_if = "Option::is_none")]
381 foursquare_id: Option<String>,
382 /// Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
383 #[serde(default, skip_serializing_if = "Option::is_none")]
384 foursquare_type: Option<String>,
385 /// Google Places identifier of the venue
386 #[serde(default, skip_serializing_if = "Option::is_none")]
387 google_place_id: Option<String>,
388 /// Google Places type of the venue. (See supported types.)
389 #[serde(default, skip_serializing_if = "Option::is_none")]
390 google_place_type: Option<String>,
391 /// Inline keyboard attached to the message
392 #[serde(default, skip_serializing_if = "Option::is_none")]
393 reply_markup: Option<InlineKeyboardMarkup>,
394 /// Content of the message to be sent instead of the venue
395 #[serde(default, skip_serializing_if = "Option::is_none")]
396 input_message_content: Option<InputMessageContent>,
397 /// Url of the thumbnail for the result
398 #[serde(default, skip_serializing_if = "Option::is_none")]
399 thumb_url: Option<String>,
400 /// Thumbnail width
401 #[serde(default, skip_serializing_if = "Option::is_none")]
402 thumb_width: Option<i64>,
403 /// Thumbnail height
404 #[serde(default, skip_serializing_if = "Option::is_none")]
405 thumb_height: Option<i64>,
406 },
407
408 /// Represents a contact with a phone number. By default, this contact will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the contact.
409 /// Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
410 Contact {
411 /// Unique identifier for this result, 1-64 Bytes
412 id: String,
413 /// Contact's phone number
414 phone_number: String,
415 /// Contact's first name
416 first_name: String,
417 /// Contact's last name
418 #[serde(default, skip_serializing_if = "Option::is_none")]
419 last_name: Option<String>,
420 /// Additional data about the contact in the form of a vCard, 0-2048 bytes
421 #[serde(default, skip_serializing_if = "Option::is_none")]
422 vcard: Option<String>,
423 /// Inline keyboard attached to the message
424 #[serde(default, skip_serializing_if = "Option::is_none")]
425 reply_markup: Option<InlineKeyboardMarkup>,
426 /// Content of the message to be sent instead of the contact
427 #[serde(default, skip_serializing_if = "Option::is_none")]
428 input_message_content: Option<InputMessageContent>,
429 /// Url of the thumbnail for the result
430 #[serde(default, skip_serializing_if = "Option::is_none")]
431 thumb_url: Option<String>,
432 /// Thumbnail width
433 #[serde(default, skip_serializing_if = "Option::is_none")]
434 thumb_width: Option<i64>,
435 /// Thumbnail height
436 #[serde(default, skip_serializing_if = "Option::is_none")]
437 thumb_height: Option<i64>,
438 },
439
440 /// Represents a Game.
441 /// Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
442 Game {
443 /// Unique identifier for this result, 1-64 bytes
444 id: String,
445 /// Short name of the game
446 game_short_name: String,
447 /// Inline keyboard attached to the message
448 #[serde(default, skip_serializing_if = "Option::is_none")]
449 reply_markup: Option<InlineKeyboardMarkup>,
450 },
451
452 /// Represents a link to a photo stored on the Telegram servers. By default, this photo will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the photo.
453 Photo {
454 /// Unique identifier for this result, 1-64 bytes
455 id: String,
456 /// A valid file identifier of the photo
457 photo_file_id: String,
458 /// Title for the result
459 #[serde(default, skip_serializing_if = "Option::is_none")]
460 title: Option<String>,
461 /// Short description of the result
462 #[serde(default, skip_serializing_if = "Option::is_none")]
463 description: Option<String>,
464 /// Caption of the photo to be sent, 0-1024 characters after entities parsing
465 #[serde(default, skip_serializing_if = "Option::is_none")]
466 caption: Option<String>,
467 /// Mode for parsing entities in the photo caption. See formatting options for more details.
468 #[serde(default, skip_serializing_if = "Option::is_none")]
469 parse_mode: Option<String>,
470 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
471 #[serde(default, skip_serializing_if = "Vec::is_empty")]
472 caption_entities: Vec<MessageEntity>,
473 /// Inline keyboard attached to the message
474 #[serde(default, skip_serializing_if = "Option::is_none")]
475 reply_markup: Option<InlineKeyboardMarkup>,
476 /// Content of the message to be sent instead of the photo
477 #[serde(default, skip_serializing_if = "Option::is_none")]
478 input_message_content: Option<InputMessageContent>,
479 },
480
481 /// Represents a link to an animated GIF file stored on the Telegram servers. By default, this animated GIF file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with specified content instead of the animation.
482 Gif {
483 /// Unique identifier for this result, 1-64 bytes
484 id: String,
485 /// A valid file identifier for the GIF file
486 gif_file_id: String,
487 /// Title for the result
488 #[serde(default, skip_serializing_if = "Option::is_none")]
489 title: Option<String>,
490 /// Caption of the GIF file to be sent, 0-1024 characters after entities parsing
491 #[serde(default, skip_serializing_if = "Option::is_none")]
492 caption: Option<String>,
493 /// Mode for parsing entities in the caption. See formatting options for more details.
494 #[serde(default, skip_serializing_if = "Option::is_none")]
495 parse_mode: Option<String>,
496 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
497 #[serde(default, skip_serializing_if = "Vec::is_empty")]
498 caption_entities: Vec<MessageEntity>,
499 /// Inline keyboard attached to the message
500 #[serde(default, skip_serializing_if = "Option::is_none")]
501 reply_markup: Option<InlineKeyboardMarkup>,
502 /// Content of the message to be sent instead of the GIF animation
503 #[serde(default, skip_serializing_if = "Option::is_none")]
504 input_message_content: Option<InputMessageContent>,
505 },
506
507 /// Represents a link to a video animation (H.264/MPEG-4 AVC video without sound) stored on the Telegram servers. By default, this animated MPEG-4 file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the animation.
508 Mpeg4Gif {
509 /// Unique identifier for this result, 1-64 bytes
510 id: String,
511 /// A valid file identifier for the MPEG4 file
512 mpeg4_file_id: String,
513 /// Title for the result
514 #[serde(default, skip_serializing_if = "Option::is_none")]
515 title: Option<String>,
516 /// Caption of the MPEG-4 file to be sent, 0-1024 characters after entities parsing
517 #[serde(default, skip_serializing_if = "Option::is_none")]
518 caption: Option<String>,
519 /// Mode for parsing entities in the caption. See formatting options for more details.
520 #[serde(default, skip_serializing_if = "Option::is_none")]
521 parse_mode: Option<String>,
522 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
523 #[serde(default, skip_serializing_if = "Vec::is_empty")]
524 caption_entities: Vec<MessageEntity>,
525 /// Inline keyboard attached to the message
526 #[serde(default, skip_serializing_if = "Option::is_none")]
527 reply_markup: Option<InlineKeyboardMarkup>,
528 /// Content of the message to be sent instead of the video animation
529 #[serde(default, skip_serializing_if = "Option::is_none")]
530 input_message_content: Option<InputMessageContent>,
531 },
532
533 /// Represents a link to a sticker stored on the Telegram servers. By default, this sticker will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the sticker.
534 /// Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
535 Sticker {
536 /// Unique identifier for this result, 1-64 bytes
537 id: String,
538 /// A valid file identifier of the sticker
539 sticker_file_id: String,
540 /// Inline keyboard attached to the message
541 #[serde(default, skip_serializing_if = "Option::is_none")]
542 reply_markup: Option<InlineKeyboardMarkup>,
543 /// Content of the message to be sent instead of the sticker
544 #[serde(default, skip_serializing_if = "Option::is_none")]
545 input_message_content: Option<InputMessageContent>,
546 },
547
548 /// Represents a link to a file stored on the Telegram servers. By default, this file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the file.
549 /// Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
550 Document {
551 /// Unique identifier for this result, 1-64 bytes
552 id: String,
553 /// Title for the result
554 title: String,
555 /// A valid file identifier for the file
556 document_file_id: String,
557 /// Short description of the result
558 #[serde(default, skip_serializing_if = "Option::is_none")]
559 description: Option<String>,
560 /// Caption of the document to be sent, 0-1024 characters after entities parsing
561 #[serde(default, skip_serializing_if = "Option::is_none")]
562 caption: Option<String>,
563 /// Mode for parsing entities in the document caption. See formatting options for more details.
564 #[serde(default, skip_serializing_if = "Option::is_none")]
565 parse_mode: Option<String>,
566 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
567 #[serde(default, skip_serializing_if = "Vec::is_empty")]
568 caption_entities: Vec<MessageEntity>,
569 /// Inline keyboard attached to the message
570 #[serde(default, skip_serializing_if = "Option::is_none")]
571 reply_markup: Option<InlineKeyboardMarkup>,
572 /// Content of the message to be sent instead of the file
573 #[serde(default, skip_serializing_if = "Option::is_none")]
574 input_message_content: Option<InputMessageContent>,
575 },
576
577 /// Represents a link to a video file stored on the Telegram servers. By default, this video file will be sent by the user with an optional caption. Alternatively, you can use input_message_content to send a message with the specified content instead of the video.
578 Video {
579 /// Unique identifier for this result, 1-64 bytes
580 id: String,
581 /// A valid file identifier for the video file
582 video_file_id: String,
583 /// Title for the result
584 title: String,
585 /// Short description of the result
586 #[serde(default, skip_serializing_if = "Option::is_none")]
587 description: Option<String>,
588 /// Caption of the video to be sent, 0-1024 characters after entities parsing
589 #[serde(default, skip_serializing_if = "Option::is_none")]
590 caption: Option<String>,
591 /// Mode for parsing entities in the video caption. See formatting options for more details.
592 #[serde(default, skip_serializing_if = "Option::is_none")]
593 parse_mode: Option<String>,
594 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
595 #[serde(default, skip_serializing_if = "Vec::is_empty")]
596 caption_entities: Vec<MessageEntity>,
597 /// Inline keyboard attached to the message
598 #[serde(default, skip_serializing_if = "Option::is_none")]
599 reply_markup: Option<InlineKeyboardMarkup>,
600 /// Content of the message to be sent instead of the video
601 #[serde(default, skip_serializing_if = "Option::is_none")]
602 input_message_content: Option<InputMessageContent>,
603 },
604
605 /// Represents a link to a voice message stored on the Telegram servers. By default, this voice message will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the voice message.
606 /// Note: This will only work in Telegram versions released after 9 April, 2016. Older clients will ignore them.
607 Voice {
608 /// Unique identifier for this result, 1-64 bytes
609 id: String,
610 /// A valid file identifier for the voice message
611 voice_file_id: String,
612 /// Voice message title
613 title: String,
614 /// Caption, 0-1024 characters after entities parsing
615 #[serde(default, skip_serializing_if = "Option::is_none")]
616 caption: Option<String>,
617 /// Mode for parsing entities in the voice message caption. See formatting options for more details.
618 #[serde(default, skip_serializing_if = "Option::is_none")]
619 parse_mode: Option<String>,
620 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
621 #[serde(default, skip_serializing_if = "Vec::is_empty")]
622 caption_entities: Vec<MessageEntity>,
623 /// Inline keyboard attached to the message
624 #[serde(default, skip_serializing_if = "Option::is_none")]
625 reply_markup: Option<InlineKeyboardMarkup>,
626 /// Content of the message to be sent instead of the voice message
627 #[serde(default, skip_serializing_if = "Option::is_none")]
628 input_message_content: Option<InputMessageContent>,
629 },
630
631 /// Represents a link to an MP3 audio file stored on the Telegram servers. By default, this audio file will be sent by the user. Alternatively, you can use input_message_content to send a message with the specified content instead of the audio.
632 Audio {
633 /// Unique identifier for this result, 1-64 bytes
634 id: String,
635 /// A valid file identifier for the audio file
636 audio_file_id: String,
637 /// Caption, 0-1024 characters after entities parsing
638 #[serde(default, skip_serializing_if = "Option::is_none")]
639 caption: Option<String>,
640 /// Mode for parsing entities in the audio caption. See formatting options for more details.
641 #[serde(default, skip_serializing_if = "Option::is_none")]
642 parse_mode: Option<String>,
643 /// List of special entities that appear in the caption, which can be specified instead of parse_mode
644 #[serde(default, skip_serializing_if = "Vec::is_empty")]
645 caption_entities: Vec<MessageEntity>,
646 /// Inline keyboard attached to the message
647 #[serde(default, skip_serializing_if = "Option::is_none")]
648 reply_markup: Option<InlineKeyboardMarkup>,
649 /// Content of the message to be sent instead of the audio
650 #[serde(default, skip_serializing_if = "Option::is_none")]
651 input_message_content: Option<InputMessageContent>,
652 },
653}
654
655#[derive(Serialize, Deserialize, Clone, Debug)]
656#[serde(rename_all = "snake_case", untagged)]
657/// This object represents the content of a message to be sent as a result of an inline query
658pub enum InputMessageContent {
659 /// Represents the content of a text message to be sent as the result of an inline query.
660 Text {
661 /// Text of the message to be sent, 1-4096 characters
662 message_text: String,
663 /// Mode for parsing entities in the message text. See formatting options for more details.
664 #[serde(default, skip_serializing_if = "Option::is_none")]
665 parse_mode: Option<String>,
666 /// List of special entities that appear in message text, which can be specified instead of parse_mode
667 #[serde(default, skip_serializing_if = "Vec::is_empty")]
668 entities: Vec<MessageEntity>,
669 /// Disables link previews for links in the sent message
670 #[serde(default, skip_serializing_if = "Option::is_none")]
671 disable_web_page_preview: Option<bool>,
672 },
673
674 /// Represents the content of a location message to be sent as the result of an inline query.
675 Location {
676 /// Latitude of the location in degrees
677 latitude: f32,
678 /// Longitude of the location in degrees
679 longitude: f32,
680 /// The radius of uncertainty for the location, measured in meters; 0-1500
681 #[serde(skip_serializing_if = "Option::is_none")]
682 horizontal_accuracy: Option<f32>,
683 /// Period in seconds for which the location can be updated, should be between 60 and 86400.
684 #[serde(default, skip_serializing_if = "Option::is_none")]
685 live_period: Option<i64>,
686 /// For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
687 #[serde(default, skip_serializing_if = "Option::is_none")]
688 heading: Option<i64>,
689 /// For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. Must be between 1 and 100000 if specified.
690 #[serde(default, skip_serializing_if = "Option::is_none")]
691 proximity_alert_radius: Option<i64>,
692 },
693
694 /// Represents the content of a venue message to be sent as the result of an inline query.
695 Venue {
696 /// Latitude of the venue in degrees
697 latitude: f32,
698 /// Longitude of the venue in degrees
699 longitude: f32,
700 /// Name of the venue
701 title: String,
702 /// Address of the venue
703 address: String,
704 /// Foursquare identifier of the venue, if known
705 #[serde(default, skip_serializing_if = "Option::is_none")]
706 foursquare_id: Option<String>,
707 /// Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
708 #[serde(default, skip_serializing_if = "Option::is_none")]
709 foursquare_type: Option<String>,
710 /// Google Places identifier of the venue
711 #[serde(default, skip_serializing_if = "Option::is_none")]
712 google_place_id: Option<String>,
713 /// Google Places type of the venue. (See supported types.)
714 #[serde(default, skip_serializing_if = "Option::is_none")]
715 google_place_type: Option<String>,
716 },
717
718 /// Represents the content of a contact message to be sent as the result of an inline query.
719 Contact {
720 /// Contact's phone number
721 phone_number: String,
722 /// Contact's first name
723 first_name: String,
724 /// Contact's last name
725 #[serde(default, skip_serializing_if = "Option::is_none")]
726 last_name: Option<String>,
727 /// Additional data about the contact in the form of a vCard, 0-2048 bytes
728 #[serde(default, skip_serializing_if = "Option::is_none")]
729 vcard: Option<String>,
730 },
731
732 /// Represents the content of an invoice message to be sent as the result of an inline query.
733 Invoice {
734 /// Product name, 1-32 characters
735 title: String,
736 /// Product description, 1-255 characters
737 description: String,
738 /// Bot-defined invoice payload, 1-128 bytes. This will not be displayed to the user, use for your internal processes.
739 payload: String,
740 /// Payment provider token, obtained via @BotFather
741 provider_token: String,
742 /// Three-letter ISO 4217 currency code, see more on currencies
743 currency: String,
744 /// Price breakdown, a JSON-serialized list of components (e.g. product price, tax, discount, delivery cost, delivery tax, bonus, etc.)
745 #[serde(default, skip_serializing_if = "Vec::is_empty")]
746 prices: Vec<LabeledPrice>,
747 /// The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_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). Defaults to 0
748 #[serde(default, skip_serializing_if = "Option::is_none")]
749 max_tip_amount: Option<i64>,
750 /// A JSON-serialized array of suggested amounts of tip in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed max_tip_amount.
751 #[serde(default, skip_serializing_if = "Vec::is_empty")]
752 suggested_tip_amounts: Vec<i64>,
753 /// A JSON-serialized object for data about the invoice, which will be shared with the payment provider. A detailed description of the required fields should be provided by the payment provider.
754 #[serde(default, skip_serializing_if = "Option::is_none")]
755 provider_data: Option<String>,
756 /// URL of the product photo for the invoice. Can be a photo of the goods or a marketing image for a service.
757 #[serde(default, skip_serializing_if = "Option::is_none")]
758 photo_url: Option<String>,
759 /// Photo size in bytes
760 #[serde(default, skip_serializing_if = "Option::is_none")]
761 photo_size: Option<i64>,
762 /// Photo width
763 #[serde(default, skip_serializing_if = "Option::is_none")]
764 photo_width: Option<i64>,
765 /// Photo height
766 #[serde(default, skip_serializing_if = "Option::is_none")]
767 photo_height: Option<i64>,
768 /// Pass True if you require the user's full name to complete the order
769 #[serde(default, skip_serializing_if = "Option::is_none")]
770 need_name: Option<bool>,
771 /// Pass True if you require the user's phone number to complete the order
772 #[serde(default, skip_serializing_if = "Option::is_none")]
773 need_phone_number: Option<bool>,
774 /// Pass True if you require the user's email address to complete the order
775 #[serde(default, skip_serializing_if = "Option::is_none")]
776 need_email: Option<bool>,
777 /// Pass True if you require the user's shipping address to complete the order
778 #[serde(default, skip_serializing_if = "Option::is_none")]
779 need_shipping_address: Option<bool>,
780 /// Pass True if the user's phone number should be sent to provider
781 #[serde(default, skip_serializing_if = "Option::is_none")]
782 send_phone_number_to_provider: Option<bool>,
783 /// Pass True if the user's email address should be sent to provider
784 #[serde(default, skip_serializing_if = "Option::is_none")]
785 send_email_to_provider: Option<bool>,
786 /// Pass True if the final price depends on the shipping method
787 #[serde(default, skip_serializing_if = "Option::is_none")]
788 is_flexible: Option<bool>,
789 },
790}
791
792/// Represents a result of an inline query that was chosen by the user and sent to their chat partner.
793/// Note: It is necessary to enable inline feedback via @BotFather in order to receive these objects in updates.
794#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
795pub struct ChosenInlineResult {
796 /// The unique identifier for the result that was chosen
797 pub result_id: String,
798 /// The user that chose the result
799 pub from: User,
800 /// Sender location, only for bots that require user location
801 pub location: Option<Location>,
802 /// Identifier of the sent inline message. Available only if there is an inline keyboard attached to the message. Will be also received in callback queries and can be used to edit the message.
803 pub inline_message_id: Option<String>,
804 /// The query that was used to obtain the result
805 pub query: String,
806}
807
808/// Describes an inline message sent by a Web App on behalf of a user.
809#[derive(Serialize, Deserialize, Clone, Debug, Builder)]
810pub struct SentWebAppMessage {
811 /// Identifier of the sent inline message.Available only if there is an inline keyboard attached to the message.
812 pub inline_message_id: Option<String>,
813}