Merge pull request #61 from dhghf/#57-patch

Modified msgtype of send_text & send_html methods
This commit is contained in:
Ville Ranki 2020-03-18 20:08:21 +02:00 committed by GitHub
commit d11498cd9f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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")
async def send_text(self, room, body):
async def send_text(self, room, body, msgtype="m.notice"):
msg = {
"body": body,
"msgtype": "m.text"
"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.text",
"msgtype": msgtype,
"format": "org.matrix.custom.html",
"formatted_body": html,
"body": plaintext

View File

@ -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)