rubenlagus / TelegramBots

Java library to create bots using Telegram Bots API
https://telegram.me/JavaBotsApi
MIT License
4.69k stars 1.19k forks source link

Cannot download picture #360

Closed ksokolovskyi closed 6 years ago

ksokolovskyi commented 6 years ago

I need to download picture via bot. I got the path to it, then i used downloadFile() method and then got java.io.File. But from it i got image with 90x90 resolution. When i opened link in my browser - https://api.telegram.org/file/bot/, smth like that but with my parameters, i got error (cannot display image because it contains errors). How to fix this problem?

rubenlagus commented 6 years ago

When you get a Message with a photo (https://core.telegram.org/bots/api#message) you will receive several sizes, make sure you are downloading the one with the biggest size to get the higher resolution.