tdlib / telegram-bot-api

Telegram Bot API server
https://core.telegram.org/bots
Boost Software License 1.0
3.2k stars 602 forks source link

Allow to send any type of file with InlineQueryResultDocument #644

Open Sarisan opened 1 month ago

Sarisan commented 1 month ago

It is not officially supported by Bot API yet, but you can actually put any file like PNG there and set mine type to zip. It will be sent and displayed properly in any client, except for the moment when file is being downloaded by Telegram server, it will show it as file.zip during download. Can all other mime types like gif, png, jpg, mp4, webm, webp and other popular ones be supported too?

levlam commented 1 month ago

It can't be supported now. Inline mode isn't different from sending files by URL on behalf of the user. It works by downloading content of the specified URL server-side and using it as message content. The content of the URL must uniquely determine the type of the message. PNG and JPG files are treated as photos and therefore can be used only for InlineQueryResultPhoto.

Sarisan commented 1 month ago

PNG and JPG files are treated as photos and therefore can be used only for InlineQueryResultPhoto.

In this case they are supposed to be sent as files, original files, not compressed photos. I just noticed that official API reference tells that sendDocument is also valid for GIF, PDF and ZIP only, while in reality it can be used with absolutely any other type of file.