diff --git a/base-config.yaml b/base-config.yaml index 61872e0..3f80b32 100644 --- a/base-config.yaml +++ b/base-config.yaml @@ -45,6 +45,7 @@ greetings: # 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. +# enter 'none' to avoid sending a message, but still be notified in the notification_room listed below. greeting_rooms: '!someroomid:server.tld': generic '!someotherroom:server.tld': generic diff --git a/community/bot.py b/community/bot.py index e9bb856..84cfb15 100644 --- a/community/bot.py +++ b/community/bot.py @@ -121,8 +121,11 @@ class CommunityBot(Plugin): greeting_name = self.config['greeting_rooms'][room_id] nick = self.client.parse_user_id(evt.sender)[0] pill = '{nick}'.format(mxid=evt.sender, nick=nick) - greeting = greeting_map[greeting_name].format(user=pill) - await self.client.send_notice(evt.room_id, html=greeting) + if greeting_name != "none": + greeting = greeting_map[greeting_name].format(user=pill) + 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') roomname = roomnamestate['name'] diff --git a/maubot.yaml b/maubot.yaml index ce37ac4..97f4af9 100644 --- a/maubot.yaml +++ b/maubot.yaml @@ -1,6 +1,6 @@ maubot: 0.1.0 id: org.jobmachine.communitybot -version: 0.1.2 +version: 0.1.3 license: MIT modules: - community