Files and Mini Apps
File inputs
Section titled “File inputs”InputFile supports four sources:
| Constructor | Behavior |
|---|---|
InputFile::file_id |
Reuse a file already stored by Telegram |
InputFile::url |
Let Telegram download a remote file |
InputFile::bytes |
Upload bytes held in memory |
InputFile::path |
Read a local file with bounded access when explicitly requested |
The complete protocol automatically discovers uploads at any nesting depth and creates separate multipart references for albums, media thumbnails, covers, rich messages, stickers, stories, and webhook certificates.
use jingzhe::{InputFile, SendDocument};
async fn send_document(bot: &Bot, chat_id: i64) -> jingzhe::Result<()> { bot.request(SendDocument::new(chat_id, InputFile::path("report.pdf"))).await?; Ok(())}File limits
Section titled “File limits”The default upload and download limit is 20 MiB per file and can be adjusted:
let bot = bot.file_limits(50_000_000, 20_000_000)?;Official per-method limits still apply. Local validation also limits images to 10 MB and thumbnails to 200 kB. Uploaded files are read into memory with a bound.
Download
Section titled “Download”download returns the full byte buffer. download_to(&file, &mut writer).await? streams chunks into an async target without caching the entire file:
bot.download_to(&file, &mut writer).await?;A failed download may leave partial output. The caller is responsible for flushing, atomic replacement, and cleanup.
The repository example examples/files.rs demonstrates InputFile::path, GetFile, download, and reusing a file_id.
Mini Apps
Section titled “Mini Apps”Mini App entry points include:
InlineButton::web_appKeyboardButton::web_appMenuButton::WebApp- Menu settings
WebAppDataAnswerWebAppQuery- Prepared message and button save methods
Query results share the InlineQueryResult and InputMessageContent models. User input and Mini App data still require application validation.