rubenlagus / TelegramApi

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

how to get list of already joind channels or groups #14

Closed mehdi1602 closed 7 years ago

mehdi1602 commented 7 years ago

Hi Guys, the client calls onChat function in the ChatHandeler for a lot of chats. I want to know wheter I already joined to a chat (channel or group) or not? or equally is there any way to have a list of group and channels that i have joined already?

fbotis commented 7 years ago

TLRequestMessagesGetDialogs getDialogs = new TLRequestMessagesGetDialogs(); getDialogs.setOffsetPeer(new TLInputPeerSelf()); TLAbsDialogs dialogs = api.doRpcCall(getDialogs); for (TLAbsChat c : dialogs.getChats()) { ....

mehdi1602 commented 7 years ago

thank you @fbotis but your code sometimes returns channels that I have not joined yet. I want a list of all channels that I have joined.

rubenlagus commented 7 years ago

@fbotis request will only return those channels that you actually join, aka those channels that you will see in any of the telegram app.