From 0d8ea81dbd8df357b606ccdae5bc136aedc91394 Mon Sep 17 00:00:00 2001 From: saces Date: Fri, 13 Feb 2026 23:47:14 +0100 Subject: [PATCH] demobot: emulate startup behavior from simplematrixbotlib --- smal/src/demobot/demobot.py | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/smal/src/demobot/demobot.py b/smal/src/demobot/demobot.py index 0fdc282..f8e32e4 100644 --- a/smal/src/demobot/demobot.py +++ b/smal/src/demobot/demobot.py @@ -61,10 +61,25 @@ class DemoBot(SMALBot): logger.info(f"ignored a message: {msg}") + def listjoinedrooms(self): + roomlist = self.joinedrooms() + for room in roomlist: + if room["is_direct"]: + txt = "Hey, I'm back for secret talk :)" + else: + txt = "I'm back online." + self.sendnotice(room["roomid"], txt) + def main(): - # create and run the bot + # create and initialize the bot bot = DemoBot(DEFAULT_PREFIX) + + # the bot's matrix client is ready to use now + # request the list of joined rooms + bot.listjoinedrooms() + + # start syncing forever (listen for incommmig messages/events) bot.run()