Refactor and add region comments

This commit is contained in:
Tulir Asokan
2018-01-22 21:49:21 +02:00
parent 8a3ccb6e8c
commit b862399bfb
4 changed files with 135 additions and 64 deletions
+7
View File
@@ -24,6 +24,8 @@ from .db import Message as DBMessage
log = None
# region Matrix to Telegram
class MessageEntityReply(MessageEntityUnknown):
def __init__(self, offset=0, length=0, msg_id=0):
super().__init__(offset, length)
@@ -186,6 +188,9 @@ def matrix_to_telegram(html, user_id=None):
log.exception("Failed to convert Matrix format:\nhtml=%s", html)
# endregion
# region Telegram to Matrix
def telegram_event_to_matrix(evt, source):
text = evt.message
html = telegram_to_matrix(evt.message, evt.entities) if evt.entities else None
@@ -301,6 +306,8 @@ def _telegram_to_matrix(text, entities):
return "".join(html)
# endregion
def init(context):
global log
_, _, parent_log, _ = context