mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 20:14:51 +00:00
Pyrofork: Add personal_chat field to class Chat
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
52b23f2a19
commit
1f5a4f1363
1 changed files with 13 additions and 1 deletions
|
|
@ -186,6 +186,10 @@ class Chat(Object):
|
|||
|
||||
birthday (:obj:`~pyrogram.types.Birthday`, *optional*):
|
||||
User Date of birth.
|
||||
|
||||
personal_chat (:obj:`~pyrogram.types.Chat`, *optional*):
|
||||
For private chats, the personal channel of the user.
|
||||
Returned only in :meth:`~pyrogram.Client.get_chat`.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
|
|
@ -234,7 +238,8 @@ class Chat(Object):
|
|||
reply_color: "types.ChatColor" = None,
|
||||
profile_color: "types.ChatColor" = None,
|
||||
business_info: "types.BusinessInfo" = None,
|
||||
birthday: "types.Birthday" = None
|
||||
birthday: "types.Birthday" = None,
|
||||
personal_chat: "types.Chat" = None
|
||||
):
|
||||
super().__init__(client)
|
||||
|
||||
|
|
@ -281,6 +286,7 @@ class Chat(Object):
|
|||
self.profile_color = profile_color
|
||||
self.business_info = business_info
|
||||
self.birthday = birthday
|
||||
self.personal_chat = personal_chat
|
||||
|
||||
@property
|
||||
def full_name(self) -> str:
|
||||
|
|
@ -420,6 +426,12 @@ class Chat(Object):
|
|||
parsed_chat.business_info = types.BusinessInfo._parse(client, full_user, users)
|
||||
birthday = getattr(full_user, "birthday", None)
|
||||
parsed_chat.birthday = types.Birthday._parse(birthday) if birthday is not None else None
|
||||
personal_chat = await client.invoke(
|
||||
raw.functions.channels.GetChannels(
|
||||
id=[await client.resolve_peer(utils.get_channel_id(full_user.personal_channel_id))]
|
||||
)
|
||||
)
|
||||
parsed_chat.personal_chat = Chat._parse_chat(client, personal_chat.chats[0])
|
||||
|
||||
if full_user.pinned_msg_id:
|
||||
parsed_chat.pinned_message = await client.get_messages(
|
||||
|
|
|
|||
Loading…
Reference in a new issue