LonamiWebs / Telethon

Pure Python 3 MTProto API Telegram client library, for bots too!
https://docs.telethon.dev
MIT License
10.02k stars 1.41k forks source link

User objects username attribute is not populated #4471

Open Arbiter-S opened 1 month ago

Arbiter-S commented 1 month ago

Code that causes the issue

GPs_list = [1234567891]
@client.on(events.NewMessage(chats=GPs_list))
async def handler(event):
    user = await event.get_sender()
    print(user.username)

client.start()
client.run_until_disconnected()

Expected behavior

User objects to have username attribute populated.

Actual behavior

Users have None as their username.

Traceback

None

Telethon version

1.37.0

Python version

3.12.4

Operating system (including distribution name and version)

Windows 11

Other details

I checked this with another 3rd party client named Plus and users did have usernames visible to my account. It might help to mention the group has their members list hidden.

Checklist