rubenlagus / TelegramApi

Java library to create Telegram Clients
MIT License
300 stars 108 forks source link

How to recieve messages having photos and videos? #9

Closed afshar-mohammad closed 7 years ago

afshar-mohammad commented 7 years ago

I've implemented many methods in DefaultUpdatesHandler and I recieve none of the messages with a file attached. How can I recieve them?

rubenlagus commented 7 years ago

They arrive in normal messages but with Media content

afshar-mohammad commented 7 years ago

Actually I assume that there should be a function with an update as argument which returns TLAbsMessageMedia when we call update.getMessage() , so that I can handle the media content, but there is none.

TLAbsMessage cannot be converted to for example TLMessageMediaPhoto, so basically I can't handle photo messages in onTLUpdateNewMessageCustom(TLUpdateNewMessage update) because update.getMessage() is a TLAbsMessage. Then where do media messages go!?

afshar-mohammad commented 7 years ago

oh I got it!! update.getMessage().getMedia() does it! thanks!

I'm really wondering how Telegram employees not get confused with it!! They've made the worst API I've ever used so far in terms of structure and order!

mehdi1602 commented 7 years ago

hi pazis, Have you find the way of downloading file?