rustigram_types/inline.rs
1use crate::chat::Location;
2use crate::user::User;
3use serde::{Deserialize, Serialize};
4
5#[derive(Debug, Clone, Serialize, Deserialize)]
6/// An incoming inline query.
7///
8/// Sent when a user types `@YourBot something` in any chat. Respond with
9/// [`answerInlineQuery`](https://core.telegram.org/bots/api#answerinlinequery)
10/// within 10 seconds.
11pub struct InlineQuery {
12 /// Unique identifier for this query.
13 pub id: String,
14 /// The user who sent the query.
15 pub from: User,
16 /// Text of the query (up to 256 characters).
17 pub query: String,
18 /// Offset of the result to be returned.
19 pub offset: String,
20 /// Type of the chat from which the query was sent.
21 pub chat_type: Option<String>,
22 /// Sender's location, if enabled.
23 pub location: Option<Location>,
24}
25
26#[derive(Debug, Clone, Serialize, Deserialize)]
27/// The result a user chose from an inline query.
28///
29/// Delivered only when the bot has been granted access to inline feedback.
30/// Set up in [@BotFather](https://t.me/BotFather) under "Inline Feedback".
31pub struct ChosenInlineResult {
32 /// Identifier of the chosen result.
33 pub result_id: String,
34 /// The user who chose the result.
35 pub from: User,
36 /// Sender's location, if enabled.
37 pub location: Option<Location>,
38 /// Identifier of the sent inline message, if applicable.
39 pub inline_message_id: Option<String>,
40 /// The query used to obtain the result.
41 pub query: String,
42}
43
44#[derive(Debug, Clone, Serialize, Deserialize)]
45#[serde(tag = "type", rename_all = "snake_case")]
46/// One result to show in an inline query answer.
47///
48/// Up to 50 results can be returned per [`answerInlineQuery`](https://core.telegram.org/bots/api#answerinlinequery) call.
49/// Each variant corresponds to a different content type (article, photo,
50/// video, etc.). Cached variants re-use a previously uploaded Telegram
51/// `file_id` rather than a URL.
52pub enum InlineQueryResult {
53 /// A link to an article or web page.
54 Article(InlineQueryResultArticle),
55 /// A link to a photo.
56 Photo(InlineQueryResultPhoto),
57 /// A link to an animated GIF.
58 Gif(InlineQueryResultGif),
59 /// A link to a video animation (MPEG4 without sound).
60 Mpeg4Gif(InlineQueryResultMpeg4Gif),
61 /// A link to a video.
62 Video(InlineQueryResultVideo),
63 /// A link to an audio file.
64 Audio(InlineQueryResultAudio),
65 /// A link to a voice recording.
66 Voice(InlineQueryResultVoice),
67 /// A link to a general file.
68 Document(InlineQueryResultDocument),
69 /// A geographic location.
70 Location(InlineQueryResultLocation),
71 /// A venue.
72 Venue(InlineQueryResultVenue),
73 /// A contact.
74 Contact(InlineQueryResultContact),
75 /// A game.
76 Game(InlineQueryResultGame),
77 /// A photo from a Telegram `file_id`.
78 CachedPhoto(InlineQueryResultCachedPhoto),
79 /// A GIF from a Telegram `file_id`.
80 CachedGif(InlineQueryResultCachedGif),
81 /// An MPEG4 GIF from a Telegram `file_id`.
82 CachedMpeg4Gif(InlineQueryResultCachedMpeg4Gif),
83 /// A sticker from a Telegram `file_id`.
84 CachedSticker(InlineQueryResultCachedSticker),
85 /// A document from a Telegram `file_id`.
86 CachedDocument(InlineQueryResultCachedDocument),
87 /// A video from a Telegram `file_id`.
88 CachedVideo(InlineQueryResultCachedVideo),
89 /// A voice message from a Telegram `file_id`.
90 CachedVoice(InlineQueryResultCachedVoice),
91 /// An audio file from a Telegram `file_id`.
92 CachedAudio(InlineQueryResultCachedAudio),
93}
94
95#[derive(Debug, Clone, Serialize, Deserialize)]
96/// Represents an article link in an inline query result.
97pub struct InlineQueryResultArticle {
98 /// Unique identifier for this result (1–64 bytes).
99 pub id: String,
100 /// Title of the result.
101 pub title: String,
102 /// Content of the message to be sent.
103 pub input_message_content: InputMessageContent,
104 /// Inline keyboard attached to the message.
105 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
106 /// URL of the result.
107 pub url: Option<String>,
108 /// Short description of the result.
109 pub description: Option<String>,
110 /// URL of the thumbnail for the result.
111 pub thumbnail_url: Option<String>,
112 /// Thumbnail width in pixels.
113 pub thumbnail_width: Option<u32>,
114 /// Thumbnail height in pixels.
115 pub thumbnail_height: Option<u32>,
116}
117
118#[derive(Debug, Clone, Serialize, Deserialize)]
119/// A photo result in an inline query.
120pub struct InlineQueryResultPhoto {
121 /// Unique identifier for this result (1–64 bytes).
122 pub id: String,
123 /// A valid URL of the photo (JPEG, max 5 MB).
124 pub photo_url: String,
125 /// URL of the thumbnail for the photo.
126 pub thumbnail_url: String,
127 /// Photo width in pixels.
128 pub photo_width: Option<u32>,
129 /// Photo height in pixels.
130 pub photo_height: Option<u32>,
131 /// Title for the result.
132 pub title: Option<String>,
133 /// Short description of the result.
134 pub description: Option<String>,
135 /// Caption of the media (0–1024 characters).
136 pub caption: Option<String>,
137 /// Parse mode for the caption. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
138 pub parse_mode: Option<crate::message::ParseMode>,
139 /// Inline keyboard attached to the message.
140 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
141 /// Content of the message to be sent instead of the media.
142 pub input_message_content: Option<InputMessageContent>,
143 /// Show the caption above the media instead of below.
144 pub show_caption_above_media: Option<bool>,
145}
146
147#[derive(Debug, Clone, Serialize, Deserialize)]
148/// An animated GIF result in an inline query.
149pub struct InlineQueryResultGif {
150 /// Unique identifier for this result (1–64 bytes).
151 pub id: String,
152 /// A valid URL for the GIF file (max 1 MB).
153 pub gif_url: String,
154 /// URL of the static or animated thumbnail for the result.
155 pub thumbnail_url: String,
156 /// Width of the GIF in pixels.
157 pub gif_width: Option<u32>,
158 /// Height of the GIF in pixels.
159 pub gif_height: Option<u32>,
160 /// Duration of the GIF in seconds.
161 pub gif_duration: Option<u32>,
162 /// Title for the result.
163 pub title: Option<String>,
164 /// Caption of the media (0–1024 characters).
165 pub caption: Option<String>,
166 /// Parse mode for the caption. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
167 pub parse_mode: Option<crate::message::ParseMode>,
168 /// Inline keyboard attached to the message.
169 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
170 /// Content of the message to be sent instead of the media.
171 pub input_message_content: Option<InputMessageContent>,
172 /// Show the caption above the media instead of below.
173 pub show_caption_above_media: Option<bool>,
174}
175#[derive(Debug, Clone, Serialize, Deserialize)]
176/// An MPEG4 animated GIF result in an inline query.
177pub struct InlineQueryResultMpeg4Gif {
178 /// Unique identifier for this result (1–64 bytes).
179 pub id: String,
180 /// A valid URL for the MPEG4 file (max 1 MB).
181 pub mpeg4_url: String,
182 /// URL of the static or animated thumbnail.
183 pub thumbnail_url: String,
184 /// Video width in pixels.
185 pub mpeg4_width: Option<u32>,
186 /// Video height in pixels.
187 pub mpeg4_height: Option<u32>,
188 /// Video duration in seconds.
189 pub mpeg4_duration: Option<u32>,
190 /// Title for the result.
191 pub title: Option<String>,
192 /// Caption of the media (0–1024 characters).
193 pub caption: Option<String>,
194 /// Parse mode for the caption. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
195 pub parse_mode: Option<crate::message::ParseMode>,
196 /// Inline keyboard attached to the message.
197 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
198 /// Content of the message to be sent instead of the media.
199 pub input_message_content: Option<InputMessageContent>,
200 /// Show the caption above the media instead of below.
201 pub show_caption_above_media: Option<bool>,
202}
203#[derive(Debug, Clone, Serialize, Deserialize)]
204/// A video result in an inline query.
205pub struct InlineQueryResultVideo {
206 /// Unique identifier for this result (1–64 bytes).
207 pub id: String,
208 /// A valid URL for the video file.
209 pub video_url: String,
210 /// MIME type of the video (`text/html` or `video/mp4`).
211 pub mime_type: String,
212 /// URL of the thumbnail for the video.
213 pub thumbnail_url: String,
214 /// Title for the result.
215 pub title: String,
216 /// Caption of the media (0–1024 characters).
217 pub caption: Option<String>,
218 /// Parse mode for the caption. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
219 pub parse_mode: Option<crate::message::ParseMode>,
220 /// Video width in pixels.
221 pub video_width: Option<u32>,
222 /// Video height in pixels.
223 pub video_height: Option<u32>,
224 /// Video duration in seconds.
225 pub video_duration: Option<u32>,
226 /// Short description of the result.
227 pub description: Option<String>,
228 /// Inline keyboard attached to the message.
229 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
230 /// Content of the message to be sent instead of the media.
231 pub input_message_content: Option<InputMessageContent>,
232 /// Show the caption above the media instead of below.
233 pub show_caption_above_media: Option<bool>,
234}
235#[derive(Debug, Clone, Serialize, Deserialize)]
236/// An audio result in an inline query.
237pub struct InlineQueryResultAudio {
238 /// Unique identifier for this result (1–64 bytes).
239 pub id: String,
240 /// A valid URL for the audio file.
241 pub audio_url: String,
242 /// Title.
243 pub title: String,
244 /// Caption of the media (0–1024 characters).
245 pub caption: Option<String>,
246 /// Parse mode for the caption. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
247 pub parse_mode: Option<crate::message::ParseMode>,
248 /// Performer.
249 pub performer: Option<String>,
250 /// Audio duration in seconds.
251 pub audio_duration: Option<u32>,
252 /// Inline keyboard attached to the message.
253 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
254 /// Content of the message to be sent instead of the media.
255 pub input_message_content: Option<InputMessageContent>,
256}
257#[derive(Debug, Clone, Serialize, Deserialize)]
258/// A voice recording result in an inline query.
259pub struct InlineQueryResultVoice {
260 /// Unique identifier for this result (1–64 bytes).
261 pub id: String,
262 /// A valid URL for the voice recording.
263 pub voice_url: String,
264 /// Recording title.
265 pub title: String,
266 /// Caption of the media (0–1024 characters).
267 pub caption: Option<String>,
268 /// Parse mode for the caption. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
269 pub parse_mode: Option<crate::message::ParseMode>,
270 /// Recording duration in seconds.
271 pub voice_duration: Option<u32>,
272 /// Inline keyboard attached to the message.
273 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
274 /// Content of the message to be sent instead of the media.
275 pub input_message_content: Option<InputMessageContent>,
276}
277#[derive(Debug, Clone, Serialize, Deserialize)]
278/// A general file result in an inline query.
279pub struct InlineQueryResultDocument {
280 /// Unique identifier for this result (1–64 bytes).
281 pub id: String,
282 /// Title for the result.
283 pub title: String,
284 /// Caption of the media (0–1024 characters).
285 pub caption: Option<String>,
286 /// Parse mode for the caption. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
287 pub parse_mode: Option<crate::message::ParseMode>,
288 /// A valid URL for the file.
289 pub document_url: String,
290 /// MIME type of the document (`application/pdf` or `application/zip`).
291 pub mime_type: String,
292 /// Short description of the result.
293 pub description: Option<String>,
294 /// Inline keyboard attached to the message.
295 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
296 /// Content of the message to be sent instead of the media.
297 pub input_message_content: Option<InputMessageContent>,
298 /// URL of the thumbnail for the result.
299 pub thumbnail_url: Option<String>,
300 /// Thumbnail width in pixels.
301 pub thumbnail_width: Option<u32>,
302 /// Thumbnail height in pixels.
303 pub thumbnail_height: Option<u32>,
304}
305#[derive(Debug, Clone, Serialize, Deserialize)]
306/// A location result in an inline query.
307pub struct InlineQueryResultLocation {
308 /// Unique identifier for this result (1–64 bytes).
309 pub id: String,
310 /// Location latitude in degrees.
311 pub latitude: f64,
312 /// Location longitude in degrees.
313 pub longitude: f64,
314 /// Location title.
315 pub title: String,
316 /// Radius of uncertainty for the location, in metres (0–1500).
317 pub horizontal_accuracy: Option<f64>,
318 /// Period in seconds during which the location can be updated (60–86400).
319 pub live_period: Option<u32>,
320 /// Direction of movement in degrees (1–360) for live locations.
321 pub heading: Option<u16>,
322 /// Maximum distance in metres for proximity alerts.
323 pub proximity_alert_radius: Option<u32>,
324 /// Inline keyboard attached to the message.
325 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
326 /// Content of the message to be sent instead of the media.
327 pub input_message_content: Option<InputMessageContent>,
328 /// URL of the thumbnail for the result.
329 pub thumbnail_url: Option<String>,
330 /// Thumbnail width in pixels.
331 pub thumbnail_width: Option<u32>,
332 /// Thumbnail height in pixels.
333 pub thumbnail_height: Option<u32>,
334}
335#[derive(Debug, Clone, Serialize, Deserialize)]
336/// A venue result in an inline query.
337pub struct InlineQueryResultVenue {
338 /// Unique identifier for this result (1–64 bytes).
339 pub id: String,
340 /// Venue latitude in degrees.
341 pub latitude: f64,
342 /// Venue longitude in degrees.
343 pub longitude: f64,
344 /// Venue title.
345 pub title: String,
346 /// Venue address.
347 pub address: String,
348 /// Foursquare identifier of the venue.
349 pub foursquare_id: Option<String>,
350 /// Foursquare type of the venue.
351 pub foursquare_type: Option<String>,
352 /// Google Places identifier of the venue.
353 pub google_place_id: Option<String>,
354 /// Google Places type of the venue.
355 pub google_place_type: Option<String>,
356 /// Inline keyboard attached to the message.
357 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
358 /// Content of the message to be sent instead of the media.
359 pub input_message_content: Option<InputMessageContent>,
360 /// URL of the thumbnail for the result.
361 pub thumbnail_url: Option<String>,
362 /// Thumbnail width in pixels.
363 pub thumbnail_width: Option<u32>,
364 /// Thumbnail height in pixels.
365 pub thumbnail_height: Option<u32>,
366}
367#[derive(Debug, Clone, Serialize, Deserialize)]
368/// A contact result in an inline query.
369pub struct InlineQueryResultContact {
370 /// Unique identifier for this result (1–64 bytes).
371 pub id: String,
372 /// Contact phone number.
373 pub phone_number: String,
374 /// Contact first name.
375 pub first_name: String,
376 /// Contact last name.
377 pub last_name: Option<String>,
378 /// Contact vCard (0–2048 bytes).
379 pub vcard: Option<String>,
380 /// Inline keyboard attached to the message.
381 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
382 /// Content of the message to be sent instead of the media.
383 pub input_message_content: Option<InputMessageContent>,
384 /// URL of the thumbnail for the result.
385 pub thumbnail_url: Option<String>,
386 /// Thumbnail width in pixels.
387 pub thumbnail_width: Option<u32>,
388 /// Thumbnail height in pixels.
389 pub thumbnail_height: Option<u32>,
390}
391#[derive(Debug, Clone, Serialize, Deserialize)]
392/// A game result in an inline query.
393pub struct InlineQueryResultGame {
394 /// Unique identifier for this result (1–64 bytes).
395 pub id: String,
396 /// Short name of the game.
397 pub game_short_name: String,
398 /// Inline keyboard attached to the message.
399 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
400}
401#[derive(Debug, Clone, Serialize, Deserialize)]
402/// A photo result using a previously uploaded Telegram `file_id`.
403pub struct InlineQueryResultCachedPhoto {
404 /// Unique identifier for this result (1–64 bytes).
405 pub id: String,
406 /// A valid Telegram `file_id` of the cached media.
407 pub photo_file_id: String,
408 /// Title for the result.
409 pub title: Option<String>,
410 /// Short description of the result.
411 pub description: Option<String>,
412 /// Caption of the media (0–1024 characters).
413 pub caption: Option<String>,
414 /// Parse mode for the caption. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
415 pub parse_mode: Option<crate::message::ParseMode>,
416 /// Inline keyboard attached to the message.
417 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
418 /// Content of the message to be sent instead of the media.
419 pub input_message_content: Option<InputMessageContent>,
420 /// Show the caption above the media instead of below.
421 pub show_caption_above_media: Option<bool>,
422}
423#[derive(Debug, Clone, Serialize, Deserialize)]
424/// An animated GIF result using a previously uploaded Telegram `file_id`.
425pub struct InlineQueryResultCachedGif {
426 /// Unique identifier for this result (1–64 bytes).
427 pub id: String,
428 /// A valid Telegram `file_id` of the cached media.
429 pub gif_file_id: String,
430 /// Title for the result.
431 pub title: Option<String>,
432 /// Short description of the result.
433 pub caption: Option<String>,
434 /// Parse mode for the caption. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
435 pub parse_mode: Option<crate::message::ParseMode>,
436 /// Inline keyboard attached to the message.
437 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
438 /// Content of the message to be sent instead of the media.
439 pub input_message_content: Option<InputMessageContent>,
440 /// Show the caption above the media instead of below.
441 pub show_caption_above_media: Option<bool>,
442}
443#[derive(Debug, Clone, Serialize, Deserialize)]
444/// An MPEG4 GIF result using a previously uploaded Telegram `file_id`.
445pub struct InlineQueryResultCachedMpeg4Gif {
446 /// Unique identifier for this result (1–64 bytes).
447 pub id: String,
448 /// A valid Telegram `file_id` of the cached media.
449 pub mpeg4_file_id: String,
450 /// Title for the result.
451 pub title: Option<String>,
452 /// Caption of the media (0–1024 characters).
453 pub caption: Option<String>,
454 /// Parse mode for the caption. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
455 pub parse_mode: Option<crate::message::ParseMode>,
456 /// Inline keyboard attached to the message.
457 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
458 /// Content of the message to be sent instead of the media.
459 pub input_message_content: Option<InputMessageContent>,
460 /// Show the caption above the media instead of below.
461 pub show_caption_above_media: Option<bool>,
462}
463#[derive(Debug, Clone, Serialize, Deserialize)]
464/// A sticker result using a previously uploaded Telegram `file_id`.
465pub struct InlineQueryResultCachedSticker {
466 /// Unique identifier for this result (1–64 bytes).
467 pub id: String,
468 /// A valid Telegram `file_id` of the cached media.
469 pub sticker_file_id: String,
470 /// Inline keyboard attached to the message.
471 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
472 /// Content of the message to be sent instead of the media.
473 pub input_message_content: Option<InputMessageContent>,
474}
475#[derive(Debug, Clone, Serialize, Deserialize)]
476/// A document result using a previously uploaded Telegram `file_id`.
477pub struct InlineQueryResultCachedDocument {
478 /// Unique identifier for this result (1–64 bytes).
479 pub id: String,
480 /// A valid Telegram `file_id` of the cached media.
481 pub title: String,
482 /// A valid Telegram `file_id` of the cached media.
483 pub document_file_id: String,
484 /// Short description of the result.
485 pub description: Option<String>,
486 /// Caption of the media (0–1024 characters).
487 pub caption: Option<String>,
488 /// Parse mode for the caption. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
489 pub parse_mode: Option<crate::message::ParseMode>,
490 /// Inline keyboard attached to the message.
491 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
492 /// Content of the message to be sent instead of the media.
493 pub input_message_content: Option<InputMessageContent>,
494}
495#[derive(Debug, Clone, Serialize, Deserialize)]
496/// A video result using a previously uploaded Telegram `file_id`.
497pub struct InlineQueryResultCachedVideo {
498 /// Unique identifier for this result (1–64 bytes).
499 pub id: String,
500 /// A valid Telegram `file_id` of the cached media.
501 pub video_file_id: String,
502 /// Title for the result.
503 pub title: String,
504 /// Short description of the result.
505 pub description: Option<String>,
506 /// Caption of the media (0–1024 characters).
507 pub caption: Option<String>,
508 /// Parse mode for the caption. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
509 pub parse_mode: Option<crate::message::ParseMode>,
510 /// Inline keyboard attached to the message.
511 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
512 /// Content of the message to be sent instead of the media.
513 pub input_message_content: Option<InputMessageContent>,
514 /// Show the caption above the media instead of below.
515 pub show_caption_above_media: Option<bool>,
516}
517#[derive(Debug, Clone, Serialize, Deserialize)]
518/// A voice result using a previously uploaded Telegram `file_id`.
519pub struct InlineQueryResultCachedVoice {
520 /// Unique identifier for this result (1–64 bytes).
521 pub id: String,
522 /// A valid Telegram `file_id` of the cached media.
523 pub voice_file_id: String,
524 /// Title for the result.
525 pub title: String,
526 /// Caption of the media (0–1024 characters).
527 pub caption: Option<String>,
528 /// Parse mode for the caption. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
529 pub parse_mode: Option<crate::message::ParseMode>,
530 /// Inline keyboard attached to the message.
531 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
532 /// Content of the message to be sent instead of the media.
533 pub input_message_content: Option<InputMessageContent>,
534}
535#[derive(Debug, Clone, Serialize, Deserialize)]
536/// An audio result using a previously uploaded Telegram `file_id`.
537pub struct InlineQueryResultCachedAudio {
538 /// Unique identifier for this result (1–64 bytes).
539 pub id: String,
540 /// A valid Telegram `file_id` of the cached media.
541 pub audio_file_id: String,
542 /// Caption of the media (0–1024 characters).
543 pub caption: Option<String>,
544 /// Parse mode for the caption. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
545 pub parse_mode: Option<crate::message::ParseMode>,
546 /// Inline keyboard attached to the message.
547 pub reply_markup: Option<crate::keyboard::InlineKeyboardMarkup>,
548 /// Content of the message to be sent instead of the media.
549 pub input_message_content: Option<InputMessageContent>,
550}
551
552#[derive(Debug, Clone, Serialize, Deserialize)]
553#[serde(untagged)]
554/// The content of a message sent as the result of an inline query.
555pub enum InputMessageContent {
556 /// The message text.
557 Text(InputTextMessageContent),
558 /// A location on a map.
559 Location(InputLocationMessageContent),
560 /// A venue.
561 Venue(InputVenueMessageContent),
562 /// A contact.
563 Contact(InputContactMessageContent),
564 /// An invoice.
565 Invoice(InputInvoiceMessageContent),
566}
567
568#[derive(Debug, Clone, Serialize, Deserialize)]
569/// Text message content for an inline query result.
570pub struct InputTextMessageContent {
571 /// Text of the message (1–4096 characters).
572 pub message_text: String,
573 /// Parse mode for the message text. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
574 pub parse_mode: Option<crate::message::ParseMode>,
575 /// Special entities in the message text.
576 pub entities: Option<Vec<crate::message::MessageEntity>>,
577 /// Options for link preview generation.
578 pub link_preview_options: Option<crate::message::LinkPreviewOptions>,
579}
580#[derive(Debug, Clone, Serialize, Deserialize)]
581/// Live location content for an inline query result.
582pub struct InputLocationMessageContent {
583 /// Latitude in degrees.
584 pub latitude: f64,
585 /// Longitude in degrees.
586 pub longitude: f64,
587 /// Radius of uncertainty for the location, in metres (0–1500).
588 pub horizontal_accuracy: Option<f64>,
589 /// Period in seconds during which the location can be updated (60–86400).
590 pub live_period: Option<u32>,
591 /// Direction of movement in degrees (1–360).
592 pub heading: Option<u16>,
593 /// Maximum distance for proximity alerts in metres.
594 pub proximity_alert_radius: Option<u32>,
595}
596#[derive(Debug, Clone, Serialize, Deserialize)]
597/// Venue content for an inline query result.
598pub struct InputVenueMessageContent {
599 /// Latitude in degrees.
600 pub latitude: f64,
601 /// Longitude in degrees.
602 pub longitude: f64,
603 /// Venue name.
604 pub title: String,
605 /// Venue address.
606 pub address: String,
607 /// Foursquare identifier of the venue.
608 pub foursquare_id: Option<String>,
609 /// Foursquare type of the venue.
610 pub foursquare_type: Option<String>,
611 /// Google Places identifier.
612 pub google_place_id: Option<String>,
613 /// Google Places type.
614 pub google_place_type: Option<String>,
615}
616#[derive(Debug, Clone, Serialize, Deserialize)]
617/// Contact content for an inline query result.
618pub struct InputContactMessageContent {
619 /// Contact phone number.
620 pub phone_number: String,
621 /// Contact first name.
622 pub first_name: String,
623 /// Contact last name.
624 pub last_name: Option<String>,
625 /// Contact vCard (0–2048 bytes).
626 pub vcard: Option<String>,
627}
628#[derive(Debug, Clone, Serialize, Deserialize)]
629/// Invoice content for an inline query result.
630pub struct InputInvoiceMessageContent {
631 /// Product name (1–32 characters).
632 pub title: String,
633 /// Product description (1–255 characters).
634 pub description: String,
635 /// Bot-defined invoice payload (1–128 bytes).
636 pub payload: String,
637 /// Payment provider token. Not required for Telegram Stars.
638 pub provider_token: Option<String>,
639 /// Three-letter ISO 4217 currency code.
640 pub currency: String,
641 /// Price breakdown.
642 pub prices: Vec<crate::payments::LabeledPrice>,
643 /// Maximum accepted tip amount in the smallest currency unit.
644 pub max_tip_amount: Option<u64>,
645 /// Suggested tip amounts in the smallest currency unit.
646 pub suggested_tip_amounts: Option<Vec<u64>>,
647 /// JSON-encoded data about the invoice for the payment provider.
648 pub provider_data: Option<String>,
649 /// URL of the product photo.
650 pub photo_url: Option<String>,
651 /// Photo size in bytes.
652 pub photo_size: Option<u64>,
653 /// Photo width in pixels.
654 pub photo_width: Option<u32>,
655 /// Photo height in pixels.
656 pub photo_height: Option<u32>,
657 /// Requests the buyer's full name.
658 pub need_name: Option<bool>,
659 /// Requests the buyer's phone number.
660 pub need_phone_number: Option<bool>,
661 /// Requests the buyer's email address.
662 pub need_email: Option<bool>,
663 /// Requests the buyer's shipping address.
664 pub need_shipping_address: Option<bool>,
665 /// Passes the buyer's phone number to the provider.
666 pub send_phone_number_to_provider: Option<bool>,
667 /// Passes the buyer's email address to the provider.
668 pub send_email_to_provider: Option<bool>,
669 /// `true` if the final price depends on the shipping method.
670 pub is_flexible: Option<bool>,
671}
672
673#[derive(Debug, Clone, Serialize, Deserialize)]
674/// A message sent from a Web App on behalf of the user.
675pub struct SentWebAppMessage {
676 /// Identifier of the sent inline message.
677 pub inline_message_id: Option<String>,
678}