telegram-bot-api
telegram-bot-api copied to clipboard
[Bug] Sending channel-photo by file_id error
I tried to execute avatar-photo from channel and send it to another chat by file_id. So, Bot is Admin in this channel and has privileges to get it.
Sending photo/document by big_file_id or small_file_id causes TypeOfFileMismatch API Exception.
This error can be avoided if we download file and send it from local-storage. But, we will lose a lot in performance.
https://core.telegram.org/bots/api#chatphoto: "This file_id can be used only for photo download and only for as long as the photo is not changed".
Sorry, it's my mistake. So, how about raising another type of Exception? I got stuck on "types mismatch".
The type of the file is actually "profile_photo", which you can see in the path returned by getFile. And only "photo" files can be used in sendPhoto. I will change the error message to include expected and received file types, but I doubt that this change will actually help. It will just change the question to "why is it impossible to use profile_photo in sendPhoto?"
"why is it impossible to use profile_photo in sendPhoto?" — This question references user to api limitations docs. And in my opinion it's clearer.
So, thanks that helped me!