@@ -3777,6 +3777,7 @@ def __init__(
37773777 self ._channel : PartialUser = broadcaster
37783778 self ._colour : Colour | None = Colour .from_hex (payload ["color" ]) if payload ["color" ] else None
37793779 self ._badges : list [ChatMessageBadge ] = badges
3780+ self ._message_id : str = payload ["message_id" ]
37803781
37813782 def __repr__ (self ) -> str :
37823783 return f"<Chatter id={ self .id } name={ self .name } , channel={ self .channel } >"
@@ -4002,6 +4003,31 @@ async def warn(self, moderator: str | PartialUser, reason: str) -> Warning:
40024003 )
40034004 return Warning (data ["data" ][0 ], http = self ._http )
40044005
4006+ async def delete_message (self , moderator : str | PartialUser ) -> None :
4007+ """|coro|
4008+
4009+ Delete the message that this :class:`~twitchio.Chatter` object was created from.
4010+
4011+ .. important::
4012+ Restrictions:
4013+
4014+ - The message must have been created within the last 6 hours.
4015+ - The chatter must not be the broadcaster.
4016+ - The chatter must not be another moderator.
4017+
4018+ .. note::
4019+ The ``moderator`` provided must have the ``moderator:manage:chat_messages`` scope.
4020+
4021+ Parameters
4022+ ----------
4023+ moderator: str | int | PartialUser
4024+ The ID, or PartialUser, of the user that has permission to moderate the broadcaster's chat room.
4025+ This ID must match the user ID in the user access token.
4026+ """
4027+ await self ._http .delete_chat_message (
4028+ broadcaster_id = self .channel , moderator_id = moderator , token_for = moderator , message_id = self ._message_id
4029+ )
4030+
40054031 async def block (
40064032 self ,
40074033 source : Literal ["chat" , "whisper" ] | None = None ,
0 commit comments