fix: Fixes room alias resolution error handling

Ensures room ID is returned only if present in the response
Improves reliability by returning the alias if resolution fails
This commit is contained in:
Kumi 2024-11-28 09:40:55 +01:00
parent ee94d66737
commit 93de30baac
Signed by: kumi
GPG key ID: ECBCC9082395383F

View file

@ -138,7 +138,12 @@ class RoombaBot:
Returns:
str: The room ID of the resolved room alias.
"""
return await self.client.room_resolve_alias(room_alias)
response = await self.client.room_resolve_alias(room_alias)
if response and "room_id" in response:
return response["room_id"]
return room_alias
async def block_room(self, room_id, block):
"""Block or unblock a room.