Telegram retrieving groupname by user id

516 views Asked by At

I'm using telethon GetFullUserRequest to retrieve user id and name.
I want to see if this user id is a member of a group, or even a member of multiple groups.
I googled but I can't find a solution.

Is this possible, and if yes, how?

Regards and thanks in advance.

1

There are 1 answers

0
Lonami On BEST ANSWER

As @go2nirvana pointed out, you can get the common chats, but that's all you can do (there is simply no way to know which broadcast channels they're in, or what groups unless you're in them too).

This is done with GetCommonChatsRequest and is what clients show as "groups in common" when you open someone's profile:

async def main():
    result = await client(functions.messages.GetCommonChatsRequest(
        user_id='username',
        max_id=0,
        limit=100
    ))

    for chat in result.chats:
        ...