add configurable welcome sleep timer

This commit is contained in:
William Kray
2024-10-19 16:48:37 -07:00
parent 10b37350d4
commit 9631172334
2 changed files with 5 additions and 0 deletions
+3
View File
@@ -64,6 +64,9 @@ greeting_rooms:
'!someotherroom:server.tld': generic '!someotherroom:server.tld': generic
'!myencryptedroomid:server.tld': encrypted '!myencryptedroomid:server.tld': encrypted
# how long to wait (in seconds) before sending a greeting to a new
welcome_sleep: 0
# add a room ID here to send a message to when someone joins the above rooms # add a room ID here to send a message to when someone joins the above rooms
# (optional) # (optional)
notification_room: notification_room:
+2
View File
@@ -24,6 +24,7 @@ from .db import upgrade_table
class Config(BaseProxyConfig): class Config(BaseProxyConfig):
def do_update(self, helper: ConfigUpdateHelper) -> None: def do_update(self, helper: ConfigUpdateHelper) -> None:
helper.copy("sleep") helper.copy("sleep")
helper.copy("welcome_sleep")
helper.copy("admins") helper.copy("admins")
helper.copy("moderators") helper.copy("moderators")
helper.copy("parent_room") helper.copy("parent_room")
@@ -305,6 +306,7 @@ class CommunityBot(Plugin):
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": if greeting_name != "none":
greeting = greeting_map[greeting_name].format(user=pill) greeting = greeting_map[greeting_name].format(user=pill)
time.sleep(self.config['welcome_sleep'])
await self.client.send_notice(evt.room_id, html=greeting) await self.client.send_notice(evt.room_id, html=greeting)
else: else:
pass pass