Skip to content

Commit abede77

Browse files
committed
Add delete method to ChatMessage
1 parent 0f243ef commit abede77

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

twitchio/models/eventsub_.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1463,6 +1463,31 @@ def color(self) -> Colour | None:
14631463
"""An alias for colour"""
14641464
return self.colour
14651465

1466+
async def delete(self, moderator: str | PartialUser) -> None:
1467+
"""|coro|
1468+
1469+
Delete this message from the associated chat room.
1470+
1471+
.. important::
1472+
Restrictions:
1473+
1474+
- The message must have been created within the last 6 hours.
1475+
- The message must not belong to the broadcaster.
1476+
- The message must not belong to another moderator.
1477+
1478+
.. note::
1479+
The ``moderator`` provided must have the ``moderator:manage:chat_messages`` scope.
1480+
1481+
Parameters
1482+
----------
1483+
moderator: str | int | PartialUser
1484+
The ID, or PartialUser, of the user that has permission to moderate the broadcaster's chat room.
1485+
This ID must match the user ID in the user access token.
1486+
"""
1487+
await self._http.delete_chat_message(
1488+
broadcaster_id=self.broadcaster, moderator_id=moderator, token_for=moderator, message_id=self.id
1489+
)
1490+
14661491

14671492
class ChatSub:
14681493
"""

0 commit comments

Comments
 (0)