pub enum SentFile {
Id(String),
Url(String),
Upload(String),
}Expand description
Describe a file to be sent to the API. There are three ways to send files (photos, stickers, audio, media, etc.):
Id: If the file is already stored somewhere on the Telegram servers, you don’t need to re-upload it: each file object has a file_id field, simply pass this file_id as a parameter instead of uploading. There are no limits for files sent this way.Url: Provide Telegram with an HTTP URL for the file to be sent. Telegram will download and send the file. 5 MB max size for photos and 20 MB max for other types of content.Upload: Post the file using multipart/form-data in the usual way that files are uploaded via the browser. 10 MB max size for photos, 50 MB for other files
Variants§
Id(String)
For files already on Telegram’s servers
- It is not possible to change the file type when resending by file_id. I.e. a video can’t be sent as a photo, a photo can’t be sent as a document, etc.
- It is not possible to resend thumbnails.
- Resending a photo by file_id will send all of its sizes.
- file_id is unique for each individual bot and can’t be transferred from one bot to another.
- file_id uniquely identifies a file, but a file can have different valid file_ids even for the same bot
Url(String)
File to be downloaded from a Url
- The target file must have the correct MIME type (e.g., audio/mpeg for sendAudio, etc.).
- sendDocument currently only works for GIF, PDF and ZIP files.
- To use sendVoice, the file must have the type audio/ogg and be no more than 1MB in size. 1-20MB voice notes will be sent as files.
- Other configurations may work but we can’t guarantee that they will
Upload(String)
Path of a local file to be uploaded to Telegram’s servers. 10 MB max size for photos, 50 MB for other files
Implementations§
Trait Implementations§
Source§impl<'de> Deserialize<'de> for SentFile
impl<'de> Deserialize<'de> for SentFile
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for SentFile
impl RefUnwindSafe for SentFile
impl Send for SentFile
impl Sync for SentFile
impl Unpin for SentFile
impl UnwindSafe for SentFile
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more