Implement Matrix -> Telegram formatted message bridging

This commit is contained in:
Tulir Asokan
2018-01-21 20:48:14 +02:00
parent f1d8312806
commit a8359441b0
6 changed files with 198 additions and 7 deletions
+5 -1
View File
@@ -79,7 +79,11 @@ class Portal:
def handle_matrix_message(self, sender, message):
type = message["msgtype"]
if type == "m.text":
sender.client.send_message(self.peer, message["body"])
if "format" in message and message["format"] == "org.matrix.custom.html":
message, entities = formatter.matrix_to_telegram(message["formatted_body"])
sender.send_message(self.peer, message, entities=entities)
else:
sender.send_message(self.peer, message["body"])
def handle_telegram_message(self, sender, evt):
self.log.debug("Sending %s to %s by %d", evt.message, self.mxid, sender.id)