Fix handling of null m.relates_to objects. Fixes #317
This commit is contained in:
@@ -88,7 +88,7 @@ def matrix_to_telegram(html: str) -> ParsedMessage:
|
|||||||
def matrix_reply_to_telegram(content: Dict[str, Any], tg_space: TelegramID,
|
def matrix_reply_to_telegram(content: Dict[str, Any], tg_space: TelegramID,
|
||||||
room_id: Optional[MatrixRoomID] = None) -> Optional[TelegramID]:
|
room_id: Optional[MatrixRoomID] = None) -> Optional[TelegramID]:
|
||||||
try:
|
try:
|
||||||
reply = content.get("m.relates_to", {}).get("m.in_reply_to", {})
|
reply = (content.get("m.relates_to", None) or {}).get("m.in_reply_to", {})
|
||||||
if not reply:
|
if not reply:
|
||||||
return None
|
return None
|
||||||
room_id = room_id or reply["room_id"]
|
room_id = room_id or reply["room_id"]
|
||||||
|
|||||||
Reference in New Issue
Block a user