Skip to content

Commit c8de619

Browse files
committed
make get_chat and get_me return uses_unofficial_app flag for a full user
1 parent 45eda84 commit c8de619

2 files changed

Lines changed: 16 additions & 0 deletions

File tree

pyrogram/types/user_and_chats/chat.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -516,6 +516,11 @@ class Chat(Object):
516516
Note added to the user's contact.
517517
Returned only in :meth:`~pyrogram.Client.get_chat`
518518
519+
uses_unofficial_app (``bool``, *optional*):
520+
True, if the user was marked as a user of an unofficial
521+
Telegram app with security risk
522+
Returned only in :meth:`~pyrogram.Client.get_chat`
523+
519524
raw (:obj:`~pyrogram.raw.types.UserFull` | :obj:`~pyrogram.raw.types.ChatFull` | :obj:`~pyrogram.raw.types.ChannelFull`, *optional*):
520525
The raw chat or user object, as received from the Telegram API.
521526
@@ -660,6 +665,7 @@ def __init__(
660665
display_gifts_button: Optional[bool] = None,
661666
accepted_gift_types: Optional["types.AcceptedGiftTypes"] = None,
662667
note: Optional["types.FormattedText"] = None,
668+
uses_unofficial_app: Optional[bool] = None,
663669
raw: Optional[Union["raw.types.UserFull", "raw.types.ChatFull", "raw.types.ChannelFull"]] = None
664670
):
665671
super().__init__(client)
@@ -798,6 +804,7 @@ def __init__(
798804
self.display_gifts_button = display_gifts_button
799805
self.accepted_gift_types = accepted_gift_types
800806
self.note = note
807+
self.uses_unofficial_app = uses_unofficial_app
801808
self.raw = raw
802809

803810
# region Deprecated
@@ -1089,6 +1096,7 @@ async def _parse_full_user(
10891096
parsed_chat.display_gifts_button = user.display_gifts_button
10901097
parsed_chat.accepted_gift_types = types.AcceptedGiftTypes._parse(user.disallowed_gifts)
10911098
parsed_chat.note = types.FormattedText._parse(client, user.note)
1099+
parsed_chat.uses_unofficial_app = user.unofficial_security_risk
10921100

10931101
return parsed_chat
10941102

pyrogram/types/user_and_chats/user.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -386,6 +386,11 @@ class User(Object, Update):
386386
note (:obj:`~pyrogram.types.FormattedText`, *optional*):
387387
Note added to the user's contact.
388388
389+
uses_unofficial_app (``bool``, *optional*):
390+
True, if the user was marked as a user of an unofficial
391+
Telegram app with security risk
392+
Returned only in :meth:`~pyrogram.Client.get_me`
393+
389394
raw (:obj:`~pyrogram.raw.base.User` | :obj:`~pyrogram.raw.base.UserStatus`, *optional*):
390395
The raw user or user status object, as received from the Telegram API.
391396
@@ -493,6 +498,7 @@ def __init__(
493498
pending_rating_date: Optional[datetime] = None,
494499
accepted_gift_types: Optional["types.AcceptedGiftTypes"] = None,
495500
note: Optional["types.FormattedText"] = None,
501+
uses_unofficial_app: Optional[bool] = None,
496502
raw: Optional[Union["raw.base.User", "raw.base.UserStatus"]] = None
497503
):
498504
super().__init__(client)
@@ -587,6 +593,7 @@ def __init__(
587593
self.pending_rating_date = pending_rating_date
588594
self.accepted_gift_types = accepted_gift_types
589595
self.note = note
596+
self.uses_unofficial_app = uses_unofficial_app
590597
self.raw = raw
591598

592599
@property
@@ -773,6 +780,7 @@ async def _parse_full(client, user: "raw.types.UserFull", users: dict, chats: di
773780
parsed_user.pending_rating_date = utils.timestamp_to_datetime(user.stars_my_pending_rating_date)
774781
parsed_user.accepted_gift_types = types.AcceptedGiftTypes._parse(user.disallowed_gifts)
775782
parsed_user.note = types.FormattedText._parse(client, user.note)
783+
parsed_user.uses_unofficial_app = user.unofficial_security_risk
776784

777785
return parsed_user
778786

0 commit comments

Comments
 (0)