Commit f78079b8 authored by kaiyou's avatar kaiyou

Support sending formatted Matrix messages

parent 20400908
Pipeline #212 passed with stage
in 1 minute and 1 second
from matrix_client import client as matrix_client
from matrix_client import client, api
from amonit import util
......@@ -12,6 +12,9 @@ def stdout(context):
def matrix_room(context, hs, token, roomid, message):
""" Send a message to a given Matrix room
"""
matrix = matrix_client.MatrixHttpApi(hs, token=token)
message = util.render(message, context)
matrix.send_message(roomid, message)
matrix = api.MatrixHttpApi(hs, token=token)
rendered = util.render(message, context)
room = client.Room(None, roomid)
matrix.send_message_event(
roomid, "m.room.message", room.get_html_content(rendered)
)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment