Merge pull request #61 from dhghf/#57-patch
Modified msgtype of send_text & send_html methods
This commit is contained in:
commit
d11498cd9f
8
bot.py
8
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.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
|
||||
|
|
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue