From 27930603a527916609fb56274fb6de44d87a2e1c Mon Sep 17 00:00:00 2001 From: Kumi Date: Thu, 28 Nov 2024 09:48:41 +0100 Subject: [PATCH] fix: Enhances alias resolution with type check Replaces a dictionary key existence check with an instance check, ensuring the response is of the expected type RoomResolveAliasResponse. This improves robustness by relying on a concrete type instead of assuming dictionary structure. --- src/matrix_roomba/bot.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/matrix_roomba/bot.py b/src/matrix_roomba/bot.py index 0681f6a..ad72eac 100644 --- a/src/matrix_roomba/bot.py +++ b/src/matrix_roomba/bot.py @@ -140,8 +140,8 @@ class RoombaBot: """ response = await self.client.room_resolve_alias(room_alias) - if response and "room_id" in response: - return response["room_id"] + if isinstance(response, nio.RoomResolveAliasResponse): + return response.room_id return room_alias