Skip to content

Commit 0c2a285

Browse files
feat: Added the parameter revoke_reactions to the method ban_chat_member
1 parent d596406 commit 0c2a285

1 file changed

Lines changed: 11 additions & 0 deletions

File tree

pyrogram/methods/chats/ban_chat_member.py

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ async def ban_chat_member(
3030
user_id: Union[int, str],
3131
until_date: datetime = utils.zero_datetime(),
3232
revoke_messages: Optional[bool] = None,
33+
revoke_reactions: Optional[bool] = None,
3334
) -> Union["types.Message", bool]:
3435
"""Ban a user from a group, a supergroup or a channel.
3536
In the case of supergroups and channels, the user will not be able to return to the group on their own using
@@ -54,6 +55,9 @@ async def ban_chat_member(
5455
revoke_messages (``bool``, *optional*):
5556
Pass True to delete all messages in the chat for the user who is being removed.
5657
58+
revoke_reactions (``bool``, *optional*):
59+
Pass True to delete all reactions in the chat for the user who is being removed.
60+
5761
Returns:
5862
:obj:`~pyrogram.types.Message` | ``bool``: On success, a service message will be returned (when applicable),
5963
otherwise, in case a message object couldn't be returned, True is returned.
@@ -110,4 +114,11 @@ async def ban_chat_member(
110114
)
111115
)
112116

117+
if revoke_reactions:
118+
await self.invoke(
119+
raw.functions.messages.DeleteParticipantReactions(
120+
peer=chat_peer, participant=user_peer
121+
)
122+
)
123+
113124
return next(iter(await utils.parse_messages(client=self, messages=r)), True)

0 commit comments

Comments
 (0)