From 6814cae5caf4de994b16da5e80da84649d2cccdd Mon Sep 17 00:00:00 2001 From: Dylan Hackworth Date: Tue, 17 Mar 2020 12:40:41 -0500 Subject: [PATCH] > Except in cron module to allow running timed commands. --- bot.py | 8 ++++---- modules/cron.py | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/bot.py b/bot.py index 4b71f87..47a769f 100755 --- a/bot.py +++ b/bot.py @@ -70,16 +70,16 @@ class Bot: self.logger.debug("Logger initialized") - async def send_text(self, room, body): + async def send_text(self, room, body, msgtype="m.notice"): msg = { "body": body, - "msgtype": "m.notice" + "msgtype": msgtype } await self.client.room_send(room.room_id, 'm.room.message', msg) - async def send_html(self, room, html, plaintext): + async def send_html(self, room, html, plaintext, msgtype="m.notice"): msg = { - "msgtype": "m.notice", + "msgtype": msgtype, "format": "org.matrix.custom.html", "formatted_body": html, "body": plaintext diff --git a/modules/cron.py b/modules/cron.py index 4dc4052..fb68f83 100644 --- a/modules/cron.py +++ b/modules/cron.py @@ -54,7 +54,7 @@ class MatrixModule(BotModule): commands = self.daily_commands[room_id] for command in commands: if int(command['time']) == self.last_hour: - await bot.send_text(bot.get_room_by_id(room_id), command['command']) + await bot.send_text(bot.get_room_by_id(room_id), command['command'], 'm.text') else: delete_rooms.append(room_id)