Skip to content

Commit 96b7af1

Browse files
feat: Added the delete_chat_reactions_by_sender method
1 parent 603585f commit 96b7af1

3 files changed

Lines changed: 54 additions & 0 deletions

File tree

compiler/docs/compiler.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -328,6 +328,7 @@ def get_title_list(s: str) -> list:
328328
set_administrator_title
329329
set_chat_photo
330330
delete_chat_photo
331+
delete_chat_reactions_by_sender
331332
set_chat_title
332333
set_chat_description
333334
set_chat_direct_messages_group

pyrogram/methods/chats/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
from .delete_channel import DeleteChannel
2929
from .delete_folder_invite_link import DeleteFolderInviteLink
3030
from .delete_chat_photo import DeleteChatPhoto
31+
from .delete_chat_reactions_by_sender import DeleteChatReactionsBySender
3132
from .delete_folder import DeleteFolder
3233
from .delete_forum_topic import DeleteForumTopic
3334
from .delete_supergroup import DeleteSupergroup
@@ -110,6 +111,7 @@ class Chats(
110111
GetChatMember,
111112
SetChatPhoto,
112113
DeleteChatPhoto,
114+
DeleteChatReactionsBySender,
113115
DeleteFolder,
114116
SetChatTitle,
115117
SetChatTTL,
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
# Pyrogram - Telegram MTProto API Client Library for Python
2+
# Copyright (C) 2017-present Dan <https://github.com/delivrance>
3+
#
4+
# This file is part of Pyrogram.
5+
#
6+
# Pyrogram is free software: you can redistribute it and/or modify
7+
# it under the terms of the GNU Lesser General Public License as published
8+
# by the Free Software Foundation, either version 3 of the License, or
9+
# (at your option) any later version.
10+
#
11+
# Pyrogram is distributed in the hope that it will be useful,
12+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
13+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14+
# GNU Lesser General Public License for more details.
15+
#
16+
# You should have received a copy of the GNU Lesser General Public License
17+
# along with Pyrogram. If not, see <http://www.gnu.org/licenses/>.
18+
19+
from typing import Union
20+
21+
import pyrogram
22+
from pyrogram import raw
23+
24+
25+
class DeleteChatReactionsBySender:
26+
async def delete_chat_reactions_by_sender(
27+
self: "pyrogram.Client",
28+
chat_id: Union[int, str],
29+
sender_id: Union[int, str],
30+
) -> bool:
31+
"""Delete all reactions sent by a certain user in a chat.
32+
33+
.. include:: /_includes/usable-by/users.rst
34+
35+
Parameters:
36+
chat_id (``int`` | ``str``):
37+
Unique identifier (int) or username (str) of the target chat.
38+
39+
sender_id (``int`` | ``str``):
40+
Unique identifier (int) or username (str) of the user whose reactions will be deleted.
41+
42+
Returns:
43+
``bool``: True on success, False otherwise.
44+
"""
45+
46+
return await self.invoke(
47+
raw.functions.messages.DeleteParticipantReactions(
48+
peer=await self.resolve_peer(chat_id),
49+
participant=await self.resolve_peer(sender_id),
50+
)
51+
)

0 commit comments

Comments
 (0)