How do I get the MIME type of photos that users send to my bot?
I am using the Telegram Bot API through Telegraf.
My bot is saving file id's from photos and videos that users are sending it and I want to be able to download the files later. The telegram API for the method getFile
to download them states:
Note: This function may not preserve the original file name and MIME type. You should save the file's MIME type and name (if available) when the File object is received.
I am not entirely sure what this is supposed to mean. At no point I am receiving a File
object so far and it does not even contain a MIME type. I assume they want to say that the MIME type (and file name) might get mixed up when downloading the actual file and you are therefore supposed to store it yourself.
When looking at the update types for different file types they usually contain the MIME type, as shown here: Video
. Unfortunately, The update object for photos does not to contain this information: PhotoSize
. Is there any other way to get the MIME type of photos?
Thanks for your help.