mirror of
https://github.com/maubot/maubot.git
synced 2024-10-01 01:06:10 -04:00
Add react method to MaubotMessageEvent
This commit is contained in:
parent
66592ef81f
commit
d56ec94d34
@ -21,7 +21,8 @@ import attr
|
||||
from mautrix import Client as MatrixClient
|
||||
from mautrix.util.formatter import parse_html
|
||||
from mautrix.types import (EventType, MessageEvent, Event, EventID, RoomID, MessageEventContent,
|
||||
MessageType, TextMessageEventContent, Format, RelatesTo, StateEvent)
|
||||
MessageType, TextMessageEventContent, Format, RelatesTo, RelationType,
|
||||
ReactionEventContent)
|
||||
|
||||
|
||||
class EscapeHTML(Extension):
|
||||
@ -70,6 +71,11 @@ class MaubotMessageEvent(MessageEvent):
|
||||
def mark_read(self) -> Awaitable[None]:
|
||||
return self.client.send_receipt(self.room_id, self.event_id, "m.read")
|
||||
|
||||
def react(self, key: str) -> Awaitable[None]:
|
||||
content = ReactionEventContent(relates_to=RelatesTo(rel_type=RelationType.ANNOTATION,
|
||||
event_id=self.event_id, key=key))
|
||||
return self.client.send_message_event(self.room_id, EventType.REACTION, content)
|
||||
|
||||
|
||||
class MaubotMatrixClient(MatrixClient):
|
||||
def send_markdown(self, room_id: RoomID, markdown: str, msgtype: MessageType = MessageType.TEXT,
|
||||
|
Loading…
Reference in New Issue
Block a user