mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 14:04:51 +00:00
pyrofork: Add subscription_expired, subscription_period, and subscription_price field to class ChatInviteLink
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
8854710399
commit
56efb88047
2 changed files with 23 additions and 4 deletions
|
|
@ -59,7 +59,7 @@ class ExportChatInviteLink:
|
||||||
Subscription price (stars).
|
Subscription price (stars).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
``str``: On success, the new invite link as string is returned.
|
:obj:`~pyrogram.types.ChatInviteLink`: On success, the invite link is returned.
|
||||||
|
|
||||||
Example:
|
Example:
|
||||||
.. code-block:: python
|
.. code-block:: python
|
||||||
|
|
@ -78,4 +78,4 @@ class ExportChatInviteLink:
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
return r.link
|
return types.ChatInviteLink._parse(self, r)
|
||||||
|
|
|
||||||
|
|
@ -68,6 +68,15 @@ class ChatInviteLink(Object):
|
||||||
|
|
||||||
pending_join_request_count (``int``, *optional*):
|
pending_join_request_count (``int``, *optional*):
|
||||||
Number of pending join requests created using this link
|
Number of pending join requests created using this link
|
||||||
|
|
||||||
|
subscription_expired (``int``, *optional*):
|
||||||
|
Number of subscription which already expired.
|
||||||
|
|
||||||
|
subscription_period (``int``, *optional*):
|
||||||
|
The period of Subscription.
|
||||||
|
|
||||||
|
subscription_price (``int``, *optional*):
|
||||||
|
The price of Subscription (stars).
|
||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(
|
def __init__(
|
||||||
|
|
@ -83,7 +92,10 @@ class ChatInviteLink(Object):
|
||||||
expire_date: datetime = None,
|
expire_date: datetime = None,
|
||||||
member_limit: int = None,
|
member_limit: int = None,
|
||||||
member_count: int = None,
|
member_count: int = None,
|
||||||
pending_join_request_count: int = None
|
pending_join_request_count: int = None,
|
||||||
|
subscription_expired: int = None,
|
||||||
|
subscription_period: int = None,
|
||||||
|
subscription_price: int = None
|
||||||
):
|
):
|
||||||
super().__init__()
|
super().__init__()
|
||||||
|
|
||||||
|
|
@ -99,6 +111,9 @@ class ChatInviteLink(Object):
|
||||||
self.member_limit = member_limit
|
self.member_limit = member_limit
|
||||||
self.member_count = member_count
|
self.member_count = member_count
|
||||||
self.pending_join_request_count = pending_join_request_count
|
self.pending_join_request_count = pending_join_request_count
|
||||||
|
self.subscription_expired = subscription_expired
|
||||||
|
self.subscription_period = subscription_period
|
||||||
|
self.subscription_price = subscription_price
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def _parse(
|
def _parse(
|
||||||
|
|
@ -114,6 +129,7 @@ class ChatInviteLink(Object):
|
||||||
if users is not None
|
if users is not None
|
||||||
else None
|
else None
|
||||||
)
|
)
|
||||||
|
subscription_pricing = getattr(invite, "subscription_pricing", None)
|
||||||
|
|
||||||
return ChatInviteLink(
|
return ChatInviteLink(
|
||||||
invite_link=invite.link,
|
invite_link=invite.link,
|
||||||
|
|
@ -127,5 +143,8 @@ class ChatInviteLink(Object):
|
||||||
expire_date=utils.timestamp_to_datetime(invite.expire_date),
|
expire_date=utils.timestamp_to_datetime(invite.expire_date),
|
||||||
member_limit=invite.usage_limit,
|
member_limit=invite.usage_limit,
|
||||||
member_count=invite.usage,
|
member_count=invite.usage,
|
||||||
pending_join_request_count=invite.requested
|
pending_join_request_count=invite.requested,
|
||||||
|
subscription_expired=invite.subscription_expired,
|
||||||
|
subscription_period=subscription_pricing.period if subscription_pricing is not None else None,
|
||||||
|
subscription_price=subscription_pricing.amount if subscription_pricing is not None else None
|
||||||
)
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue