diff --git a/main.py b/main.py index 8c60670..0c06d63 100644 --- a/main.py +++ b/main.py @@ -272,7 +272,13 @@ async def message_callback(room: nio.MatrixRoom, event: nio.RoomMessageText) -> ratelimits[event.sender] = int(datetime.datetime.utcnow().timestamp()) + settings["ratelimit"] if command in settings["command_list"] or (admin and command in settings["admin_command_list"]): command_function = globals()[command] - await command_function(args, room, event) + if debug: + await command_function(args, room, event) + else: + try: + await command_function(args, room, event) + except Exception: + await send_text(room.room_id, "Something went wrong processing the command!") return if admin: # If it is not a command, process regular message parsing.