InputMedia

Enum InputMedia 

Source
pub enum InputMedia {
    Photo {
        media: String,
        caption: Option<String>,
        parse_mode: Option<ParseMode>,
        caption_entities: Option<Vec<MessageEntity>>,
    },
    Video {
        media: String,
        thumb: Option<InputFileVariant>,
        width: Option<u32>,
        height: Option<u32>,
        duration: Option<u32>,
        supports_streaming: Option<bool>,
        caption: Option<String>,
        parse_mode: Option<ParseMode>,
        caption_entities: Option<Vec<MessageEntity>>,
    },
    Animation {
        media: String,
        thumb: Option<InputFileVariant>,
        width: Option<u32>,
        height: Option<u32>,
        duration: Option<u32>,
        caption: Option<String>,
        parse_mode: Option<ParseMode>,
        caption_entities: Option<Vec<MessageEntity>>,
    },
    Audio {
        media: String,
        thumb: Option<InputFileVariant>,
        performer: Option<String>,
        title: Option<String>,
        duration: Option<u32>,
        caption: Option<String>,
        parse_mode: Option<ParseMode>,
        caption_entities: Option<Vec<MessageEntity>>,
    },
    Document {
        media: String,
        thumb: Option<InputFileVariant>,
        caption: Option<String>,
        parse_mode: Option<ParseMode>,
        caption_entities: Option<Vec<MessageEntity>>,
    },
}
Expand description

This object represents the content of a media message to be sent. It should be one of

  • InputMediaAnimation
  • InputMediaDocument
  • InputMediaAudio
  • InputMediaPhoto
  • InputMediaVideo

Variants§

§

Photo

Represents a photo to be sent.

Fields

§media: String

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.

§caption: Option<String>

Caption of the photo to be sent, 0-1024 characters after entities parsing

§parse_mode: Option<ParseMode>

Mode for parsing entities in the photo caption. See formatting options for more details.

§caption_entities: Option<Vec<MessageEntity>>

List of special entities that appear in the caption, which can be specified instead of parse_mode

§

Video

Represents a video to be sent.

Fields

§media: String

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.

§thumb: Option<InputFileVariant>

Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail’s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »

§width: Option<u32>

Video width

§height: Option<u32>

Video height

§duration: Option<u32>

Video duration

§supports_streaming: Option<bool>

Pass True, if the uploaded video is suitable for streaming

§caption: Option<String>

Caption of the video to be sent, 0-1024 characters after entities parsing

§parse_mode: Option<ParseMode>

Mode for parsing entities in the video caption. See formatting options for more details.

§caption_entities: Option<Vec<MessageEntity>>

List of special entities that appear in the caption, which can be specified instead of parse_mode

§

Animation

Represents an animation file (GIF or H.264/MPEG-4 AVC video without sound) to be sent.

Fields

§media: String

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.

§thumb: Option<InputFileVariant>

Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail’s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »

§width: Option<u32>

Animation width

§height: Option<u32>

Animation height

§duration: Option<u32>

Animation duration

§caption: Option<String>

Caption of the animation to be sent, 0-1024 characters after entities parsing

§parse_mode: Option<ParseMode>

Mode for parsing entities in the animation caption. See formatting options for more details.

§caption_entities: Option<Vec<MessageEntity>>

List of special entities that appear in the caption, which can be specified instead of parse_mode

§

Audio

Represents an audio file to be treated as music to be sent.

Fields

§media: String

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.

§thumb: Option<InputFileVariant>

Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail’s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »

§performer: Option<String>

Performer of the audio

§title: Option<String>

Title of the audio

§duration: Option<u32>

Duration of the audio in seconds

§caption: Option<String>

Caption of the audio to be sent, 0-1024 characters after entities parsing

§parse_mode: Option<ParseMode>

Mode for parsing entities in the audio caption. See formatting options for more details.

§caption_entities: Option<Vec<MessageEntity>>

List of special entities that appear in the caption, which can be specified instead of parse_mode

§

Document

Represents a general file to be sent.

Fields

§media: String

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.

§thumb: Option<InputFileVariant>

Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail’s width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can’t be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. More info on Sending Files »

§caption: Option<String>

Caption of the document to be sent, 0-1024 characters after entities parsing

§parse_mode: Option<ParseMode>

Mode for parsing entities in the document caption. See formatting options for more details.

§caption_entities: Option<Vec<MessageEntity>>

List of special entities that appear in the caption, which can be specified instead of parse_mode

Trait Implementations§

Source§

impl Clone for InputMedia

Source§

fn clone(&self) -> InputMedia

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Serialize for InputMedia

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.