From 2be6a761b6305f1463070232944ca0e1ff689328 Mon Sep 17 00:00:00 2001 From: Andrew Ferrazzutti Date: Mon, 11 Apr 2022 15:49:21 -0400 Subject: [PATCH] Don't bridge what look to be inbound deleted chats --- matrix_appservice_kakaotalk/portal.py | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/matrix_appservice_kakaotalk/portal.py b/matrix_appservice_kakaotalk/portal.py index ee2cb0a..77b12cd 100644 --- a/matrix_appservice_kakaotalk/portal.py +++ b/matrix_appservice_kakaotalk/portal.py @@ -198,6 +198,7 @@ class Portal(DBPortal, BasePortal): KnownChatType.VIDEO: cls._handle_kakaotalk_video, KnownChatType.AUDIO: cls._handle_kakaotalk_audio, #KnownChatType.FILE: cls._handle_kakaotalk_file, + 16385: cls._handle_kakaotalk_deleted, } # region DB conversion @@ -1086,7 +1087,7 @@ class Portal(DBPortal, BasePortal): type_str = str(chat_type) self.log.warning("No handler for chat type \"%s\" (%s)", type_str, - f"text = {chat_text}" if chat_text is not None else "no text", + f"text = \"{chat_text}\"" if chat_text is not None else "no text", ) if chat_text: events = await self._handle_kakaotalk_text( @@ -1115,6 +1116,21 @@ class Portal(DBPortal, BasePortal): self.log.info("Got feed message at %s: %s", timestamp, chat_text or "none") return [] + async def _handle_kakaotalk_deleted( + self, + attachment: Attachment | None, + timestamp: int, + chat_text: str | None, + **_ + ) -> list[EventID]: + self.log.info( + "Got deleted (?) message at %s: %s, %s", + timestamp, + f"text = \"{chat_text}\"" if chat_text is not None else "no text", + f"attachment = {attachment}" if attachment is not None else "no attachment", + ) + return [] + async def _handle_kakaotalk_text( self, intent: IntentAPI,