conogram/entities/
input_media_photo.rs

1use serde::Serialize;
2
3use crate::{
4    entities::{
5        message_entity::MessageEntity,
6        misc::input_file::{GetFiles, InputFile},
7    },
8    utils::deserialize_utils::is_false,
9};
10
11/// Represents a photo to be sent.
12///
13/// API Reference: [link](https://core.telegram.org/bots/api/#inputmediaphoto)
14#[derive(Debug, Clone, Default, PartialEq, Serialize)]
15pub struct InputMediaPhoto {
16    /// File to send. Pass a file\_id to send a file that exists on the Telegram servers (recommended), pass an HTTP URL for Telegram to get a file from the Internet, or pass “attach://\<file\_attach\_name\>” to upload a new one using multipart/form-data under \<file\_attach\_name\> name. [More information on Sending Files »](https://core.telegram.org/bots/api/#sending-files)
17    pub media: InputFile,
18
19    /// *Optional*. Caption of the photo to be sent, 0-1024 characters after entities parsing
20    #[serde(skip_serializing_if = "Option::is_none")]
21    pub caption: Option<String>,
22
23    /// *Optional*. Mode for parsing entities in the photo caption. See [formatting options](https://core.telegram.org/bots/api/#formatting-options) for more details.
24    #[serde(skip_serializing_if = "Option::is_none")]
25    pub parse_mode: Option<String>,
26
27    /// *Optional*. List of special entities that appear in the caption, which can be specified instead of *parse\_mode*
28    #[serde(skip_serializing_if = "Vec::is_empty")]
29    pub caption_entities: Vec<MessageEntity>,
30
31    /// *Optional*. Pass *True*, if the caption must be shown above the message media
32    #[serde(skip_serializing_if = "is_false")]
33    pub show_caption_above_media: bool,
34
35    /// *Optional*. Pass *True* if the photo needs to be covered with a spoiler animation
36    #[serde(skip_serializing_if = "is_false")]
37    pub has_spoiler: bool,
38}
39
40impl GetFiles for InputMediaPhoto {
41    fn get_files(&self) -> Vec<&InputFile> {
42        vec![&self.media]
43    }
44} // Divider: all content below this line will be preserved after code regen