feat(bot): add reaction event handling
Introduced a callback to handle reaction events in the bot. This enhancement improves user interaction by allowing the bot to respond to reactions, broadening its capability beyond basic message and member events. No impact on existing functionality.
This commit is contained in:
parent
005a407d93
commit
1b0d3d4ddd
1 changed files with 7 additions and 1 deletions
|
@ -12,6 +12,7 @@ from nio import (
|
|||
RoomMemberEvent,
|
||||
RoomKickResponse,
|
||||
RoomInviteResponse,
|
||||
ReactionEvent,
|
||||
)
|
||||
|
||||
import logging
|
||||
|
@ -52,6 +53,8 @@ class ApplicationBot:
|
|||
self.client.add_event_callback(self.message_callback, RoomMessageMedia)
|
||||
self.client.add_event_callback(self.invite_callback, InviteMemberEvent)
|
||||
self.client.add_event_callback(self.member_event_callback, RoomMemberEvent)
|
||||
self.client.add_event_callback(self.reaction_callback, ReactionEvent)
|
||||
|
||||
await self.client.sync_forever(timeout=30000)
|
||||
|
||||
async def message_callback(self, room: MatrixRoom, event):
|
||||
|
@ -448,7 +451,10 @@ class ApplicationBot:
|
|||
await self.client.room_send(
|
||||
room.room_id,
|
||||
"m.room.message",
|
||||
{"msgtype": "m.text", "body": f"Application #{ticket_id} does not exist."},
|
||||
{
|
||||
"msgtype": "m.text",
|
||||
"body": f"Application #{ticket_id} does not exist.",
|
||||
},
|
||||
)
|
||||
|
||||
async def close_ticket(self, room, sender, command):
|
||||
|
|
Loading…
Reference in a new issue