From 60a4c97e0413248aff99f0e0ea96b72dce406ced Mon Sep 17 00:00:00 2001 From: wulan17 Date: Sun, 18 Aug 2024 21:19:10 +0700 Subject: [PATCH] pyrofork: subscription_until_date field to class ChatMember Signed-off-by: wulan17 --- pyrogram/types/user_and_chats/chat.py | 2 +- pyrogram/types/user_and_chats/chat_member.py | 9 ++++++++- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/pyrogram/types/user_and_chats/chat.py b/pyrogram/types/user_and_chats/chat.py index be2964ed8..bf3337158 100644 --- a/pyrogram/types/user_and_chats/chat.py +++ b/pyrogram/types/user_and_chats/chat.py @@ -204,7 +204,7 @@ class Chat(Object): The maximum number of reactions that can be set on a message in the chat subscription_until_date (:py:obj:`~datetime.datetime`, *optional*): - Date when the subscription expires. + Channel members only. Date when the subscription expires. """ def __init__( diff --git a/pyrogram/types/user_and_chats/chat_member.py b/pyrogram/types/user_and_chats/chat_member.py index 792beef34..827e6a935 100644 --- a/pyrogram/types/user_and_chats/chat_member.py +++ b/pyrogram/types/user_and_chats/chat_member.py @@ -71,6 +71,9 @@ class ChatMember(Object): privileges (:obj:`~pyrogram.types.ChatPrivileges`, *optional*): Administrators only. Privileged actions that an administrator is able to take. + + subscription_until_date (:py:obj:`~datetime.datetime`, *optional*): + Channel members only. Date when the subscription will expire. """ def __init__( @@ -89,7 +92,8 @@ def __init__( is_member: bool = None, can_be_edited: bool = None, permissions: "types.ChatPermissions" = None, - privileges: "types.ChatPrivileges" = None + privileges: "types.ChatPrivileges" = None, + subscription_until_date: datetime = None ): super().__init__(client) @@ -106,6 +110,7 @@ def __init__( self.can_be_edited = can_be_edited self.permissions = permissions self.privileges = privileges + self.subscription_until_date = subscription_until_date @staticmethod def _parse( @@ -144,6 +149,7 @@ def _parse( status=enums.ChatMemberStatus.MEMBER, user=types.User._parse(client, users[member.user_id]), joined_date=utils.timestamp_to_datetime(member.date), + subscription_until_date=utils.timestamp_to_datetime(member.subscription_date), client=client ) elif isinstance(member, raw.types.ChannelParticipantAdmin): @@ -224,5 +230,6 @@ def _parse( user=types.User._parse(client, users[member.user_id]), joined_date=utils.timestamp_to_datetime(member.date), invited_by=types.User._parse(client, users[member.inviter_id]), + subscription_until_date=utils.timestamp_to_datetime(member.subscription_date), client=client )