diff --git a/src/gptbot/callbacks/__init__.py b/src/gptbot/callbacks/__init__.py index edd9d9d..368c3d4 100644 --- a/src/gptbot/callbacks/__init__.py +++ b/src/gptbot/callbacks/__init__.py @@ -29,6 +29,5 @@ RESPONSE_CALLBACKS = { } EVENT_CALLBACKS = { - Event: test_callback, MessageEvent: message_callback, } \ No newline at end of file diff --git a/src/gptbot/classes/bot.py b/src/gptbot/classes/bot.py index 1964c88..948632d 100644 --- a/src/gptbot/classes/bot.py +++ b/src/gptbot/classes/bot.py @@ -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