Skip to content

Commit

Permalink
Added Matrix Room Alias Support
Browse files Browse the repository at this point in the history
  • Loading branch information
jeremiah-k committed Apr 28, 2023
1 parent d4d4b8c commit a72e2de
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions matrix_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ async def join_matrix_room(matrix_client, room_id_or_alias: str) -> None:
"""Join a Matrix room by its ID or alias."""
try:
if room_id_or_alias.startswith("#"):
response = await matrix_client.resolve_room_alias(room_id_or_alias)
response = await matrix_client.room_resolve_alias(room_id_or_alias)
if not response.room_id:
logger.error(
f"Failed to resolve room alias '{room_id_or_alias}': {response.message}"
Expand All @@ -63,7 +63,7 @@ async def join_matrix_room(matrix_client, room_id_or_alias: str) -> None:
room_id = room_id_or_alias

if room_id not in matrix_client.rooms:
response = await matrix_client.join(room_id)
response = await matrix_client.join(room_id_or_alias)
if response and hasattr(response, "room_id"):
logger.info(f"Joined room '{room_id_or_alias}' successfully")
else:
Expand All @@ -76,6 +76,7 @@ async def join_matrix_room(matrix_client, room_id_or_alias: str) -> None:
logger.error(f"Error joining room '{room_id_or_alias}': {e}")



# Send message to the Matrix room
async def matrix_relay(room_id, message, longname, meshnet_name):
matrix_client = await connect_matrix()
Expand Down

0 comments on commit a72e2de

Please sign in to comment.