Don't bridge what look to be inbound deleted chats

This commit is contained in:
Andrew Ferrazzutti 2022-04-11 15:49:21 -04:00
parent 164bb7ce10
commit 2be6a761b6

View File

@ -198,6 +198,7 @@ class Portal(DBPortal, BasePortal):
KnownChatType.VIDEO: cls._handle_kakaotalk_video, KnownChatType.VIDEO: cls._handle_kakaotalk_video,
KnownChatType.AUDIO: cls._handle_kakaotalk_audio, KnownChatType.AUDIO: cls._handle_kakaotalk_audio,
#KnownChatType.FILE: cls._handle_kakaotalk_file, #KnownChatType.FILE: cls._handle_kakaotalk_file,
16385: cls._handle_kakaotalk_deleted,
} }
# region DB conversion # region DB conversion
@ -1086,7 +1087,7 @@ class Portal(DBPortal, BasePortal):
type_str = str(chat_type) type_str = str(chat_type)
self.log.warning("No handler for chat type \"%s\" (%s)", self.log.warning("No handler for chat type \"%s\" (%s)",
type_str, 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: if chat_text:
events = await self._handle_kakaotalk_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") self.log.info("Got feed message at %s: %s", timestamp, chat_text or "none")
return [] 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( async def _handle_kakaotalk_text(
self, self,
intent: IntentAPI, intent: IntentAPI,