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:
@@ -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
|
||||||
|
|||||||
@@ -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
@@ -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
|
||||||
|
|||||||
Reference in New Issue
Block a user