From de559f91117cc219dd325079e346203619aa6279 Mon Sep 17 00:00:00 2001 From: Dome Date: Thu, 9 Apr 2026 09:44:10 +0200 Subject: [PATCH] feat: add room_id placeholder to join notifications - Enhanced the join notification logic to support the {room_id} placeholder. - This allows administrators to include direct matrix.to deep links in notification messages. - Added a safety fallback that uses the room ID as the name if the room has no display name set. --- community/bot.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/community/bot.py b/community/bot.py index c9f115b..ab0982b 100644 --- a/community/bot.py +++ b/community/bot.py @@ -1010,14 +1010,21 @@ class CommunityBot(Plugin): await self.client.send_notice(evt.room_id, html=greeting) else: pass + if self.config["notification_room"]: roomnamestate = await self.client.get_state_event( - evt.room_id, "m.room.name" + evt.room_id, "m.room.name" ) - roomname = roomnamestate["name"] + + roomname = roomnamestate.get("name") if roomnamestate else str(evt.room_id) + notification_message = self.config[ "join_notification_message" - ].format(user=evt.sender, room=roomname) + ].format( + user=evt.sender, + room=roomname, + room_id=evt.room_id # <--- Das ist neu! + ) await self.client.send_notice( self.config["notification_room"], html=notification_message )