From 2e381a4c6684e12d4b5802d7570524727ecf80bc Mon Sep 17 00:00:00 2001 From: Kumi Date: Tue, 12 Nov 2024 21:46:31 +0100 Subject: [PATCH] fix: await resolve_room_id for async handling Switch resolve_room_id to an async call in command handling to prevent blocking operations and enhance performance. This change ensures the bot can handle room ID resolutions non-blockingly, particularly during monitoring and protection operations. It improves the overall responsiveness and reliability of the bot when processing commands that require room ID resolution. --- src/matrix_applicationbot/classes/bot.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/matrix_applicationbot/classes/bot.py b/src/matrix_applicationbot/classes/bot.py index c0c4521..f30e266 100644 --- a/src/matrix_applicationbot/classes/bot.py +++ b/src/matrix_applicationbot/classes/bot.py @@ -205,7 +205,7 @@ class ApplicationBot: elif command == "list": return await self.list_tickets(room) elif command.startswith("monitor "): - room_id = self.resolve_room_id(command.split()[1]) + room_id = await self.resolve_room_id(command.split()[1]) await self.add_monitored_room(room_id) return await self.client.room_send( room.room_id, @@ -216,7 +216,7 @@ class ApplicationBot: }, ) elif command.startswith("unmonitor"): - room_id = self.resolve_room_id(command.split()[1]) + room_id = await self.resolve_room_id(command.split()[1]) await self.remove_monitored_room(room_id) return await self.client.room_send( room.room_id, @@ -253,7 +253,7 @@ class ApplicationBot: }, ) elif command.startswith("unprotect"): - room_id = self.resolve_room_id(command.split()[1]) + room_id = await self.resolve_room_id(command.split()[1]) await self.remove_protected_room(room_id) return await self.client.room_send( room.room_id,