> Except in cron module to allow running timed commands.

This commit is contained in:
Dylan Hackworth 2020-03-17 12:40:41 -05:00
parent 91b2683d65
commit 6814cae5ca
2 changed files with 5 additions and 5 deletions

8
bot.py
View File

@ -70,16 +70,16 @@ class Bot:
self.logger.debug("Logger initialized") self.logger.debug("Logger initialized")
async def send_text(self, room, body): async def send_text(self, room, body, msgtype="m.notice"):
msg = { msg = {
"body": body, "body": body,
"msgtype": "m.notice" "msgtype": msgtype
} }
await self.client.room_send(room.room_id, 'm.room.message', msg) 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 = { msg = {
"msgtype": "m.notice", "msgtype": msgtype,
"format": "org.matrix.custom.html", "format": "org.matrix.custom.html",
"formatted_body": html, "formatted_body": html,
"body": plaintext "body": plaintext

View File

@ -54,7 +54,7 @@ class MatrixModule(BotModule):
commands = self.daily_commands[room_id] commands = self.daily_commands[room_id]
for command in commands: for command in commands:
if int(command['time']) == self.last_hour: 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: else:
delete_rooms.append(room_id) delete_rooms.append(room_id)