diff --git a/base-config.yaml b/base-config.yaml index d2c269f..269d87e 100644 --- a/base-config.yaml +++ b/base-config.yaml @@ -6,5 +6,6 @@ rooms: # (optional) notification_room: +# you can use {user} to reference the joining userID in this message message: | - Welcome! Please be sure to read the topic for helpful links and information. + Welcome {user}! Please be sure to read the topic for helpful links and information. diff --git a/maubot.yaml b/maubot.yaml index d237674..ed70711 100644 --- a/maubot.yaml +++ b/maubot.yaml @@ -1,6 +1,6 @@ maubot: 0.1.0 id: org.jobmachine.welcome -version: 0.0.2 +version: 0.0.3 modules: - welcome main_class: Greeter diff --git a/welcome.py b/welcome.py index 2372452..e703df4 100644 --- a/welcome.py +++ b/welcome.py @@ -30,7 +30,10 @@ class Greeter(Plugin): if evt.source & SyncStream.STATE: return else: - await self.client.send_notice(evt.room_id, html=self.config["message"]) + nick = self.client.parse_user_id(evt.sender)[0] + pill = '{nick}'.format(mxid=evt.sender, nick=nick) + msg = self.config["message"].format(user=pill) + await self.client.send_notice(evt.room_id, html=msg) if self.config["notification_room"]: await self.client.send_markdown(self.config["notification_room"], f"User {evt.sender} joined \ {evt.room_id} and I want everyone in this @room to know")