From ff703c282731461400dcb055d5a210ae2b894d7b Mon Sep 17 00:00:00 2001 From: Tulir Asokan Date: Tue, 6 Feb 2018 14:23:06 +0200 Subject: [PATCH] Fix two previous commits --- mautrix_telegram/formatter.py | 3 ++- mautrix_telegram/portal.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/mautrix_telegram/formatter.py b/mautrix_telegram/formatter.py index ec186337..2aaba0fa 100644 --- a/mautrix_telegram/formatter.py +++ b/mautrix_telegram/formatter.py @@ -218,7 +218,8 @@ def telegram_event_to_matrix(evt, source): + f"
{html}
") if evt.reply_to_msg_id: - msg = DBMessage.query.get((evt.reply_to_msg_id, source.tgid)) + space = evt.to_id.channel_id if isinstance(evt, Message) and isinstance(evt.to_id, PeerChannel) else source.tgid + msg = DBMessage.query.get((evt.reply_to_msg_id, space)) if msg: quote = f"Quote
" if html: diff --git a/mautrix_telegram/portal.py b/mautrix_telegram/portal.py index 0a522068..a3c9fce5 100644 --- a/mautrix_telegram/portal.py +++ b/mautrix_telegram/portal.py @@ -90,10 +90,10 @@ class Portal: # to deduplicate based on a hash of the message content. # The timestamp is only accurate to the second, so we can't rely on solely that either. - hash_content = [str(event.date.timestamp()), event.from_id, event.message] + hash_content = [event.date.timestamp(), event.message] if event.fwd_from: hash_content += [event.fwd_from.from_id, event.fwd_from.channel_id] - elif event.media: + elif isinstance(event, Message) and event.media: try: hash_content += { MessageMediaContact: lambda media: [media.user_id],