mirror of
https://github.com/williamkray/maubot-welcome.git
synced 2024-10-01 02:35:44 -04:00
enable user mention in custom message!
This commit is contained in:
parent
06843a1bd7
commit
4f00f9017f
@ -6,5 +6,6 @@ rooms:
|
|||||||
# (optional)
|
# (optional)
|
||||||
notification_room:
|
notification_room:
|
||||||
|
|
||||||
|
# you can use {user} to reference the joining userID in this message
|
||||||
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.
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
maubot: 0.1.0
|
maubot: 0.1.0
|
||||||
id: org.jobmachine.welcome
|
id: org.jobmachine.welcome
|
||||||
version: 0.0.2
|
version: 0.0.3
|
||||||
modules:
|
modules:
|
||||||
- welcome
|
- welcome
|
||||||
main_class: Greeter
|
main_class: Greeter
|
||||||
|
@ -30,7 +30,10 @@ class Greeter(Plugin):
|
|||||||
if evt.source & SyncStream.STATE:
|
if evt.source & SyncStream.STATE:
|
||||||
return
|
return
|
||||||
else:
|
else:
|
||||||
await self.client.send_notice(evt.room_id, html=self.config["message"])
|
nick = self.client.parse_user_id(evt.sender)[0]
|
||||||
|
pill = '<a href="https://matrix.to/#/{mxid}">{nick}</a>'.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"]:
|
if self.config["notification_room"]:
|
||||||
await self.client.send_markdown(self.config["notification_room"], f"User {evt.sender} joined \
|
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")
|
{evt.room_id} and I want everyone in this @room to know")
|
||||||
|
Loading…
Reference in New Issue
Block a user