Pyrofork: types: {chat,user}: Use first fragments username as normal username if normal username is None

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
wulan17 2024-01-03 10:53:32 +07:00
parent 348d6173cd
commit 5ea55040f8
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5
2 changed files with 6 additions and 0 deletions

View file

@ -307,6 +307,9 @@ class Chat(Object):
user_name = username.username
else:
usernames.append(types.Username._parse(username))
if user_name is None and usernames is not None and len(usernames) > 0:
user_name = usernames[0].username
usernames.pop(0)
return Chat(
id=peer_id,

View file

@ -249,6 +249,9 @@ class User(Object, Update):
user_name = username.username
else:
usernames.append(types.Username._parse(username))
if user_name is None and usernames is not None and len(usernames) > 0:
user_name = usernames[0].username
usernames.pop(0)
return User(
id=user.id,