rubenlagus / TelegramApi

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

get error while use TLRequestMessageGetHistory #12

Closed mehdi1602 closed 7 years ago

mehdi1602 commented 7 years ago

I used as below

            TLRequestMessagesGetHistory tlReq = new TLRequestMessagesGetHistory();
            TLAbsInputPeer _peer = (TLAbsInputPeer) new TLInputPeerChat();
            ((TLInputPeerChat) _peer).setChatId(update.getChannelId()); 
            tlReq.setPeer(_peer);
            TLAbsMessages messagesEx = kernelComm.getApi().doRpcCall(tlReq);`

but all the time i get exceptions INVALID_CHANNEL_ID or INVALID_CHAT_ID

      ` org.telegram.api.engine.RpcException: CHAT_ID_INVALID`

could you please help me to know why I get this error?

rubenlagus commented 7 years ago

If you want to get the history from a channel, you need to use inputpeerchannel, not inputpeerchat.