From cba7a701bf2e6955eeedd1a74827b354a4062f9a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Abdulkadir=20Furkan=20=C5=9Eanl=C4=B1?= Date: Thu, 16 Apr 2026 12:06:58 +0200 Subject: [PATCH] Color --- main.py | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index 84211b7..2b87b26 100755 --- a/main.py +++ b/main.py @@ -307,14 +307,23 @@ async def message_callback(conn, cursor, youtube, client, room, event): # Send the title to the channel so people know what the link is # Only do this for recent messages to prevent spam during backwards-sync if recent: - display_text = f"▶️ {title}" + plain_text = f"🎵 {title}" if channel: - display_text += f" - {channel}" + plain_text += f" - {channel}" + + # Escape HTML characters to prevent broken rendering in Matrix + escaped_text = html.escape(plain_text) + html_text = f"{escaped_text}" await client.room_send( room_id=room.room_id, message_type="m.room.message", - content={"msgtype": "m.text", "body": display_text}, + content={ + "msgtype": "m.text", + "body": plain_text, + "format": "org.matrix.custom.html", + "formatted_body": html_text + }, ) # Only add to the playlist if it's categorized as music/entertainment