Add matrix backend and relevant config generation

This commit is contained in:
2019-05-18 12:30:31 +05:30
parent 8d62ff9e71
commit 866b6782d0
3 changed files with 43 additions and 0 deletions
+12
View File
@@ -0,0 +1,12 @@
from matrix_client.client import MatrixClient
from matrix_client.api import MatrixHttpApi
def send(config, message):
if 'token' in config:
token = config["token"]
else:
token = MatrixClient(config["server"]).login(config["username"],
config["password"])
bot = MatrixHttpApi(config["server"], token=token)
bot.send_message(config["room_id"], message)