mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 12:04:51 +00:00
pyrofork: Add subscription_period and subscription_price parameters to export_chat_invite and Chat.export_invite_link
Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
889c32ca2b
commit
8854710399
2 changed files with 33 additions and 3 deletions
|
|
@ -22,12 +22,15 @@ from typing import Union
|
||||||
import pyrogram
|
import pyrogram
|
||||||
from pyrogram import raw
|
from pyrogram import raw
|
||||||
from pyrogram import types
|
from pyrogram import types
|
||||||
|
from pyrogram import utils
|
||||||
|
|
||||||
|
|
||||||
class ExportChatInviteLink:
|
class ExportChatInviteLink:
|
||||||
async def export_chat_invite_link(
|
async def export_chat_invite_link(
|
||||||
self: "pyrogram.Client",
|
self: "pyrogram.Client",
|
||||||
chat_id: Union[int, str],
|
chat_id: Union[int, str],
|
||||||
|
subscription_period: int = None,
|
||||||
|
subscription_price: int = None
|
||||||
) -> "types.ChatInviteLink":
|
) -> "types.ChatInviteLink":
|
||||||
"""Generate a new primary invite link for a chat; any previously generated primary link is revoked.
|
"""Generate a new primary invite link for a chat; any previously generated primary link is revoked.
|
||||||
|
|
||||||
|
|
@ -48,6 +51,13 @@ class ExportChatInviteLink:
|
||||||
(in the format @username).
|
(in the format @username).
|
||||||
You can also use chat public link in form of *t.me/<username>* (str).
|
You can also use chat public link in form of *t.me/<username>* (str).
|
||||||
|
|
||||||
|
subscription_period (``int``, *optional*):
|
||||||
|
Date when the subscription will expire.
|
||||||
|
for now, only 30 days is supported (30*24*60*60).
|
||||||
|
|
||||||
|
subscription_price (``int``, *optional*):
|
||||||
|
Subscription price (stars).
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
``str``: On success, the new invite link as string is returned.
|
``str``: On success, the new invite link as string is returned.
|
||||||
|
|
||||||
|
|
@ -60,7 +70,11 @@ class ExportChatInviteLink:
|
||||||
r = await self.invoke(
|
r = await self.invoke(
|
||||||
raw.functions.messages.ExportChatInvite(
|
raw.functions.messages.ExportChatInvite(
|
||||||
peer=await self.resolve_peer(chat_id),
|
peer=await self.resolve_peer(chat_id),
|
||||||
legacy_revoke_permanent=True
|
legacy_revoke_permanent=True,
|
||||||
|
subscription_pricing=raw.types.StarsSubscriptionPricing(
|
||||||
|
period=subscription_period,
|
||||||
|
amount=subscription_price
|
||||||
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -1071,7 +1071,11 @@ class Chat(Object):
|
||||||
|
|
||||||
return await self._client.leave_chat(self.id)
|
return await self._client.leave_chat(self.id)
|
||||||
|
|
||||||
async def export_invite_link(self):
|
async def export_invite_link(
|
||||||
|
self,
|
||||||
|
subscription_period: int = None,
|
||||||
|
subscription_price: int = None
|
||||||
|
):
|
||||||
"""Bound method *export_invite_link* of :obj:`~pyrogram.types.Chat`.
|
"""Bound method *export_invite_link* of :obj:`~pyrogram.types.Chat`.
|
||||||
|
|
||||||
Use as a shortcut for:
|
Use as a shortcut for:
|
||||||
|
|
@ -1085,6 +1089,14 @@ class Chat(Object):
|
||||||
|
|
||||||
chat.export_invite_link()
|
chat.export_invite_link()
|
||||||
|
|
||||||
|
Parameters:
|
||||||
|
subscription_period (``int``, *optional*):
|
||||||
|
Channel members only. Date when the subscription expires.
|
||||||
|
for now, only 30 days is supported (30*24*60*60).
|
||||||
|
|
||||||
|
subscription_price (``int``, *optional*):
|
||||||
|
Channel members only. Price of the subscription in the smallest units of the currency.
|
||||||
|
|
||||||
Returns:
|
Returns:
|
||||||
``str``: On success, the exported invite link is returned.
|
``str``: On success, the exported invite link is returned.
|
||||||
|
|
||||||
|
|
@ -1092,7 +1104,11 @@ class Chat(Object):
|
||||||
ValueError: In case the chat_id belongs to a user.
|
ValueError: In case the chat_id belongs to a user.
|
||||||
"""
|
"""
|
||||||
|
|
||||||
return await self._client.export_chat_invite_link(self.id)
|
return await self._client.export_chat_invite_link(
|
||||||
|
self.id,
|
||||||
|
subscription_period=subscription_period,
|
||||||
|
subscription_price=subscription_price
|
||||||
|
)
|
||||||
|
|
||||||
async def get_member(
|
async def get_member(
|
||||||
self,
|
self,
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue