diff --git a/mautrix_facebook/matrix.py b/mautrix_facebook/matrix.py index 686eb27dcd0f96a6d419082450f98b70ec6d40c0..5e631d4ef9f8d35313faea14d65d9b8df919e3ef 100644 --- a/mautrix_facebook/matrix.py +++ b/mautrix_facebook/matrix.py @@ -225,7 +225,7 @@ class MatrixHandler(BaseMatrixHandler): if not portal: return - timestamp = datetime.utcfromtimestamp(data.get("ts", int(time.time() * 1000)) / 1000) + timestamp = datetime.fromtimestamp(data.get("ts", int(time.time() * 1000)) / 1000) await user.client.mark_as_read([portal.thread_for(user)], at=timestamp) def filter_matrix_event(self, evt: Event) -> bool: diff --git a/mautrix_facebook/portal.py b/mautrix_facebook/portal.py index bd286d5ec54de93133620fa858265d6544c8e336..ddfadfa763b4390fce3120f2c13a131c0d23a648 100644 --- a/mautrix_facebook/portal.py +++ b/mautrix_facebook/portal.py @@ -569,6 +569,9 @@ class Portal(BasePortal): event_ids = [await self._handle_facebook_text(intent, message)] else: self.log.warning(f"Unhandled Messenger message: {message}") + return + if event_ids: + self._last_bridged_mxid = event_ids[-1] DBMessage.bulk_create(fbid=message.id, fb_receiver=self.fb_receiver, mx_room=self.mxid, event_ids=[event_id for event_id in event_ids if event_id]) await source.client.mark_as_delivered(message) @@ -655,7 +658,6 @@ class Portal(BasePortal): else: self.log.warning(f"Unsupported attachment type: {attachment}") return None - self._last_bridged_mxid = event_id return event_id async def _convert_facebook_location(self, intent: IntentAPI,