Fix event handling in GPTBot class and add missing callback entries
- Fix handling of events in the `handle_event` method of the `GPTBot` class. - Add missing callback entries in the `EVENT_CALLBACKS` dictionary.
This commit is contained in:
parent
94b2457a39
commit
9abea6e3f8
2 changed files with 5 additions and 3 deletions
|
@ -29,6 +29,5 @@ RESPONSE_CALLBACKS = {
|
|||
}
|
||||
|
||||
EVENT_CALLBACKS = {
|
||||
Event: test_callback,
|
||||
MessageEvent: message_callback,
|
||||
}
|
|
@ -461,10 +461,13 @@ class GPTBot:
|
|||
|
||||
self.logger.log("Sent image", "debug")
|
||||
|
||||
async def handle_event(self, *args, **kwargs):
|
||||
async def handle_event(self, event):
|
||||
"""Handle an event."""
|
||||
|
||||
self.logger.log(f"Handling event: {args} {kwargs}", "debug")
|
||||
for event_type, callback in EVENT_CALLBACKS.items():
|
||||
if isinstance(event, event_type):
|
||||
print(event_type, callback)
|
||||
await callback(event, self)
|
||||
|
||||
async def send_message(
|
||||
self, room: RoomID | str, message: str, notice: bool = False
|
||||
|
|
Loading…
Reference in a new issue