From 2e3ce19631cc05263853f2fa5a9f16df91f3368b Mon Sep 17 00:00:00 2001 From: Cyberes Date: Sun, 19 Mar 2023 21:10:35 -0600 Subject: [PATCH] catch exceptions and show reaction --- matrix_gpt/bot/bot_commands.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/matrix_gpt/bot/bot_commands.py b/matrix_gpt/bot/bot_commands.py index 11e930c..60367c9 100644 --- a/matrix_gpt/bot/bot_commands.py +++ b/matrix_gpt/bot/bot_commands.py @@ -4,7 +4,7 @@ from types import ModuleType from nio import AsyncClient, MatrixRoom, RoomMessageText -from .chat_functions import process_chat, send_text_to_room +from .chat_functions import process_chat, react_to_event, send_text_to_room # from .config import Config from .storage import Storage @@ -69,7 +69,11 @@ class Command: # if self.command.startswith("help"): # await self._show_help() # else: - await self._process_chat() + try: + await self._process_chat() + except Exception: + await react_to_event(self.client, self.room.room_id, self.event.event_id, '❌') + raise async def _process_chat(self): async def inner():