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

Sending Group photo #558

Closed san3ani closed 5 years ago

san3ani commented 5 years ago

Hello I am trying to get the group photo and then send it to a channel. I used GetChat to get the group info. Then I tried using SendPhoto to send the photo after setting the setPhoto to the bigFiledId (I also tried the smallFieldId) However, I keep getting the following exception org.telegram.telegrambots.exceptions.TelegramApiRequestException: Error sending photo: [400] Bad Request: type of file mismatch

Any ideas?

san3ani commented 5 years ago

The java API has nothing to do with this error. It seems the bigFiledId and smallFieldId do not correspond to the photo id that is used in the SendPhoto method.

aNNiMON commented 5 years ago

According to Telegram Bot API docs you can't use ChatPhoto file ids for anything except photo download

san3ani commented 5 years ago

According to Telegram Bot API docs you can't use ChatPhoto file ids for anything except photo download

Thanks a lot. You are 100% correct. I will try to download the photo first and then upload it and send it. I don't know why telegram didnt make the group photo similar to the user profile photo.