telegram-bot-api icon indicating copy to clipboard operation
telegram-bot-api copied to clipboard

`ChatMemberUpdated.invite_link` missing when joining public groups

Open Bibo-Joshi opened this issue 2 years ago • 8 comments

Hi. I did some testing and it looks like the invite_link field of the ChatMemberUpdated class is present only when joining private groups. For public groups, the field is missing even when the user does join via a link and not via the username of the group. I expect that the added value of the invite link is smaller for public groups as they can be found by anyone, but this behavior is was unexpected as the documentation does not suggest it. If you could document this behavior or if the behavior could be updated, I'd be grateful.

Bibo-Joshi avatar Jun 29 '23 15:06 Bibo-Joshi

It works however when people join when pressing on a chat folder invite link.

Poolitzer avatar Jun 29 '23 15:06 Poolitzer

Apparently in case of folder-join the groups primary link is used and the via_chat_folder_invite_link attribute is set to True. IMO the invite_link still being set is a bit surprising as the user didn't actively use the link. While it's understandable that the joining has to be established somehow, I would prefer for either the attribute to be or this behavior to be documented.

Bibo-Joshi avatar Jun 29 '23 15:06 Bibo-Joshi

Another insight: Apparently the link is there for groups that are newly created today …

Bibo-Joshi avatar Jun 29 '23 16:06 Bibo-Joshi

For public groups, the field is missing even when the user does join via a link and not via the username of the group.

This is not true. If the user joins the group via an invite link, the field invite_link is present. If the group is public, then users are free to join it directly, even the group was opened via an invite link. And this is exactly the behavior of most apps when user press "Join" button on the chat history screen.

levlam avatar Jun 29 '23 19:06 levlam

Thanks for the quick reply! Your explanation about the "Join" button hiding away the invite_link does sound understandable. However, joining a newly created group via invite link + join button does give the invite_link attribute (just double checked again on TG desktop windows and webk). So it seems to me that either the behavior is different for groups greated after some date or it is just inconsistent :/

Bibo-Joshi avatar Jun 30 '23 14:06 Bibo-Joshi

The behavior depends on the used app. The official Android app is known to use direct join instead of invite link for public chats.

levlam avatar Jun 30 '23 17:06 levlam

I do not believe it is an app issue only.

I can use Telethon to join a chat with the same invite link with different accounts, in one chat member update it has the link, one doesn't

Poolitzer avatar Jul 01 '23 09:07 Poolitzer