pyrofork: Add revoke_messages to ban_chat_member

pyrogram/pyrogram#1421

Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
shriMADhav U k 2024-04-28 04:53:37 +02:00 committed by wulan17
parent e70556f00f
commit 8ea36645c0
No known key found for this signature in database
GPG key ID: 318CD6CD3A6AC0A5
2 changed files with 16 additions and 4 deletions

View file

@ -30,7 +30,8 @@ class BanChatMember:
self: "pyrogram.Client",
chat_id: Union[int, str],
user_id: Union[int, str],
until_date: datetime = utils.zero_datetime()
until_date: datetime = utils.zero_datetime(),
revoke_messages: bool = None
) -> Union["types.Message", bool]:
"""Ban a user from a group, a supergroup or a channel.
In the case of supergroups and channels, the user will not be able to return to the group on their own using
@ -59,6 +60,10 @@ class BanChatMember:
If user is banned for more than 366 days or less than 30 seconds from the current time they are
considered to be banned forever. Defaults to epoch (ban forever).
revoke_messages (``bool``, *optional*):
Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed.
Always True for supergroups and channels.
Returns:
:obj:`~pyrogram.types.Message` | ``bool``: On success, a service message will be returned (when applicable),
otherwise, in case a message object couldn't be returned, True is returned.
@ -100,7 +105,8 @@ class BanChatMember:
r = await self.invoke(
raw.functions.messages.DeleteChatUser(
chat_id=abs(chat_id),
user_id=user_peer
user_id=user_peer,
revoke_history=revoke_messages
)
)

View file

@ -808,7 +808,8 @@ class Chat(Object):
async def ban_member(
self,
user_id: Union[int, str],
until_date: datetime = utils.zero_datetime()
until_date: datetime = utils.zero_datetime(),
revoke_messages: bool = None
) -> Union["types.Message", bool]:
"""Bound method *ban_member* of :obj:`~pyrogram.types.Chat`.
@ -841,6 +842,10 @@ class Chat(Object):
If user is banned for more than 366 days or less than 30 seconds from the current time they are
considered to be banned forever. Defaults to epoch (ban forever).
revoke_messages (``bool``, *optional*):
Pass True to delete all messages from the chat for the user that is being removed. If False, the user will be able to see messages in the group that were sent before the user was removed.
Always True for supergroups and channels.
Returns:
:obj:`~pyrogram.types.Message` | ``bool``: On success, a service message will be returned (when applicable), otherwise, in
case a message object couldn't be returned, True is returned.
@ -852,7 +857,8 @@ class Chat(Object):
return await self._client.ban_chat_member(
chat_id=self.id,
user_id=user_id,
until_date=until_date
until_date=until_date,
revoke_messages=revoke_messages
)
async def unban_member(