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.
This commit is contained in:
Kumi 2024-11-28 09:48:41 +01:00
parent 93de30baac
commit 27930603a5
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -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