tdlib / td

Cross-platform library for building Telegram clients
https://core.telegram.org/tdlib
Boost Software License 1.0
7.11k stars 1.44k forks source link

How to know about all joined Supergroups? #2594

Closed wowka1319 closed 11 months ago

wowka1319 commented 1 year ago

If I'm not mistaken the only way to know a supergroup is joined is chatMemberStatus* in updateSupergroup.supergroup.status. But to find out about all joined ones I need to get all updateSupergroup. How can I make sure I have received all these updates?

levlam commented 1 year ago

There is no way to do this without loading full chat list.

wowka1319 commented 1 year ago

When I get 404 for loadChats can I make sure I got updateNewChat for all joined supergroups already?

levlam commented 1 year ago

Yes, for all groups from the specified chat list.

wowka1319 commented 1 year ago

updateNewChat for a supergroup contains required updateNewChat.chat.type.supergroup_id. Is it guaranteed I got updateSupergroup for it before?

levlam commented 1 year ago

See https://core.telegram.org/tdlib/getting-started.

wowka1319 commented 1 year ago

Found the answer. Thanks a lot.

  1. When a joined channel is deleted (by its admin or Telegram because of violations) will the subscriber's account received updateSupergroup?
  2. Will updateSupergroup.supergroup.status be chatMemberStatusLeft in this case?
levlam commented 1 year ago

When a joined channel is deleted (by its admin or Telegram because of violations) will the subscriber's account received updateSupergroup?

Eventually, yes. The status can be Left or Banned.

wowka1319 commented 1 year ago

If the app was off when deleting the channel and then it started, will that updateSupergroup be received?

levlam commented 1 year ago

The user will definitely know that the chat isn't accessible anymore sooner or later.

wowka1319 commented 1 year ago

The user finds out that (after long being off) due to exactly updateSupergroup always? Or he has to remember about all chats before switch off and compare a new list after that?

levlam commented 1 year ago

updateSupergroup is sent when some field changes. I don't understand, what do you mean by "compare a list".