Skip to content

Commit

Permalink
pyrofork: subscription_until_date field to class ChatMember
Browse files Browse the repository at this point in the history
Signed-off-by: wulan17 <wulan17@nusantararom.org>
  • Loading branch information
wulan17 committed Aug 18, 2024
1 parent b5458aa commit 7ce0a87
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 1 addition & 1 deletion pyrogram/types/user_and_chats/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand Down
9 changes: 8 additions & 1 deletion pyrogram/types/user_and_chats/chat_member.py
Original file line number Diff line number Diff line change
Expand Up @@ -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__(
Expand All @@ -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)

Expand All @@ -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(
Expand Down Expand Up @@ -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_until_date),
client=client
)
elif isinstance(member, raw.types.ChannelParticipantAdmin):
Expand Down Expand Up @@ -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_until_date),
client=client
)

0 comments on commit 7ce0a87

Please sign in to comment.