Skip to content

Commit

Permalink
pyrofork: Add is_paid_reactions_available, subscription_until_date fi…
Browse files Browse the repository at this point in the history
…eld to class Chat

Signed-off-by: wulan17 <wulan17@nusantararom.org>
  • Loading branch information
wulan17 committed Aug 18, 2024
1 parent 95727c2 commit 6a4be51
Showing 1 changed file with 15 additions and 1 deletion.
16 changes: 15 additions & 1 deletion pyrogram/types/user_and_chats/chat.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ class Chat(Object):
True, if Aggressive Anti-Spam is enabled in chat.
Returned only in :meth:`~pyrogram.Client.get_chat`.
is_paid_reactions_available (``bool``, *optional*):
True, if paid reactions are available in chat.
Returned only in :meth:`~pyrogram.Client.get_chat`.
title (``str``, *optional*):
Title, for supergroups, channels and basic group chats.
Expand Down Expand Up @@ -198,6 +202,10 @@ class Chat(Object):
max_reaction_count (``int``):
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.
Returned only in :meth:`~pyrogram.Client.get_chat`.
"""

def __init__(
Expand All @@ -217,6 +225,7 @@ def __init__(
is_join_request: bool = None,
is_join_to_send: bool = None,
is_antispam: bool = None,
is_paid_reactions_available: bool = None,
is_slowmode_enabled: bool = None,
title: str = None,
username: str = None,
Expand Down Expand Up @@ -249,7 +258,8 @@ def __init__(
business_info: "types.BusinessInfo" = None,
birthday: "types.Birthday" = None,
personal_chat: "types.Chat" = None,
max_reaction_count: int = None
max_reaction_count: int = None,
subscription_until_date: datetime = None
):
super().__init__(client)

Expand All @@ -266,6 +276,7 @@ def __init__(
self.is_join_request = is_join_request
self.is_join_to_send = is_join_to_send
self.is_antispam = is_antispam
self.is_paid_reactions_available = is_paid_reactions_available
self.is_slowmode_enabled = is_slowmode_enabled
self.title = title
self.username = username
Expand Down Expand Up @@ -298,6 +309,7 @@ def __init__(
self.business_info = business_info
self.birthday = birthday
self.personal_chat = personal_chat
self.subscription_until_date = subscription_until_date

@property
def full_name(self) -> str:
Expand Down Expand Up @@ -488,7 +500,9 @@ async def _parse_full(client, chat_full: Union[raw.types.messages.ChatFull, raw.
parsed_chat.sticker_set_name = getattr(full_chat.stickerset, "short_name", None)
parsed_chat.is_participants_hidden = full_chat.participants_hidden
parsed_chat.is_antispam = full_chat.antispam
parsed_chat.is_paid_reactions_available = full_chat.paid_reactions_available
parsed_chat.folder_id = getattr(full_chat, "folder_id", None)
parsed_chat.subscription_until_date = utils.get_datetime(getattr(full_chat, "subscription_until_date", None))

linked_chat_raw = chats.get(full_chat.linked_chat_id, None)

Expand Down

0 comments on commit 6a4be51

Please sign in to comment.