add ability to not send a welcome message in a room by using the "none" label, but still get notified that someone joined

This commit is contained in:
William Kray
2024-08-16 06:20:44 -07:00
parent b6120caebf
commit af16bd9884
3 changed files with 7 additions and 3 deletions
+1
View File
@@ -45,6 +45,7 @@ greetings:
# which of the above greetings should be used in which rooms? use the exact name of each greeting # which of the above greetings should be used in which rooms? use the exact name of each greeting
# you've assigned, e.g. 'generic' or 'encrypted'. you must use the room ID here. # you've assigned, e.g. 'generic' or 'encrypted'. you must use the room ID here.
# enter 'none' to avoid sending a message, but still be notified in the notification_room listed below.
greeting_rooms: greeting_rooms:
'!someroomid:server.tld': generic '!someroomid:server.tld': generic
'!someotherroom:server.tld': generic '!someotherroom:server.tld': generic
+3
View File
@@ -121,8 +121,11 @@ class CommunityBot(Plugin):
greeting_name = self.config['greeting_rooms'][room_id] greeting_name = self.config['greeting_rooms'][room_id]
nick = self.client.parse_user_id(evt.sender)[0] nick = self.client.parse_user_id(evt.sender)[0]
pill = '<a href="https://matrix.to/#/{mxid}">{nick}</a>'.format(mxid=evt.sender, nick=nick) pill = '<a href="https://matrix.to/#/{mxid}">{nick}</a>'.format(mxid=evt.sender, nick=nick)
if greeting_name != "none":
greeting = greeting_map[greeting_name].format(user=pill) greeting = greeting_map[greeting_name].format(user=pill)
await self.client.send_notice(evt.room_id, html=greeting) await self.client.send_notice(evt.room_id, html=greeting)
else:
pass
if self.config["notification_room"]: if self.config["notification_room"]:
roomnamestate = await self.client.get_state_event(evt.room_id, 'm.room.name') roomnamestate = await self.client.get_state_event(evt.room_id, 'm.room.name')
roomname = roomnamestate['name'] roomname = roomnamestate['name']
+1 -1
View File
@@ -1,6 +1,6 @@
maubot: 0.1.0 maubot: 0.1.0
id: org.jobmachine.communitybot id: org.jobmachine.communitybot
version: 0.1.2 version: 0.1.3
license: MIT license: MIT
modules: modules:
- community - community