mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-04 22:34:52 +00:00
Add approve() and decline() bound methods to ChatJoinRequest (#863)
* Bound method approve() and decline() * Style fixes Co-authored-by: ArUn Pt <46273006+CW4RR10R@users.noreply.github.com> Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
This commit is contained in:
parent
4af9e30cfd
commit
244606eed6
1 changed files with 56 additions and 0 deletions
|
|
@ -80,3 +80,59 @@ class ChatJoinRequest(Object, Update):
|
||||||
invite_link=types.ChatInviteLink._parse(client, update.invite, users),
|
invite_link=types.ChatInviteLink._parse(client, update.invite, users),
|
||||||
client=client
|
client=client
|
||||||
)
|
)
|
||||||
|
|
||||||
|
async def approve(self) -> bool:
|
||||||
|
"""Bound method *approve* of :obj:`~pyrogram.types.ChatJoinRequest`.
|
||||||
|
|
||||||
|
Use as a shortcut for:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
client.approve_chat_join_request(
|
||||||
|
chat_id=request.chat.id,
|
||||||
|
user_id=request.from_user.id
|
||||||
|
)
|
||||||
|
|
||||||
|
Example:
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
request.approve()
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
``bool``: True on success.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
RPCError: In case of a Telegram RPC error.
|
||||||
|
"""
|
||||||
|
return await self._client.approve_chat_join_request(
|
||||||
|
chat_id=self.chat.id,
|
||||||
|
user_id=self.from_user.id
|
||||||
|
)
|
||||||
|
|
||||||
|
async def decline(self) -> bool:
|
||||||
|
"""Bound method *decline* of :obj:`~pyrogram.types.ChatJoinRequest`.
|
||||||
|
|
||||||
|
Use as a shortcut for:
|
||||||
|
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
client.decline_chat_join_request(
|
||||||
|
chat_id=request.chat.id,
|
||||||
|
user_id=request.from_user.id
|
||||||
|
)
|
||||||
|
|
||||||
|
Example:
|
||||||
|
.. code-block:: python
|
||||||
|
|
||||||
|
request.decline()
|
||||||
|
|
||||||
|
Returns:
|
||||||
|
``bool``: True on success.
|
||||||
|
|
||||||
|
Raises:
|
||||||
|
RPCError: In case of a Telegram RPC error.
|
||||||
|
"""
|
||||||
|
return await self._client.decline_chat_join_request(
|
||||||
|
chat_id=self.chat.id,
|
||||||
|
user_id=self.from_user.id
|
||||||
|
)
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue