From 81ce4635fc8a7ad5ed63352ab6505afab2a2dc54 Mon Sep 17 00:00:00 2001 From: miruka Date: Wed, 27 Nov 2019 06:30:42 -0400 Subject: [PATCH] Linkify alias in m.room.alias events --- src/python/nio_callbacks.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/python/nio_callbacks.py b/src/python/nio_callbacks.py index 149fa958..a23fcb05 100644 --- a/src/python/nio_callbacks.py +++ b/src/python/nio_callbacks.py @@ -5,6 +5,7 @@ from contextlib import suppress from dataclasses import dataclass, field from datetime import datetime from typing import Optional, Tuple +from urllib.parse import quote import nio @@ -282,7 +283,9 @@ class NioCallbacks: async def onRoomAliasEvent(self, room, ev) -> None: if ev.canonical_alias: - co = f"%1 set the room's main address to {ev.canonical_alias}." + url = f"https://matrix.to/#/{quote(ev.canonical_alias)}" + link = f"{ev.canonical_alias}" + co = f"%1 set the room's main address to {link}." else: co = "%1 removed the room's main address."