mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2025-12-29 20:14:51 +00:00
pyrofork: Add revoke_messages to ban_chat_member
pyrogram/pyrogram#1421 Signed-off-by: wulan17 <wulan17@nusantararom.org>
This commit is contained in:
parent
e70556f00f
commit
8ea36645c0
2 changed files with 16 additions and 4 deletions
|
|
@ -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
|
||||
)
|
||||
)
|
||||
|
||||
|
|
|
|||
|
|
@ -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(
|
||||
|
|
|
|||
Loading…
Reference in a new issue