feat: itchat support picture msg

This commit is contained in:
lanvent
2023-04-09 00:45:42 +08:00
parent 3174b1158c
commit 8779eab36b
4 changed files with 17 additions and 3 deletions

View File

@@ -22,6 +22,10 @@ class WeChatMessage(ChatMessage):
self.ctype = ContextType.VOICE
self.content = TmpDir().path() + itchat_msg['FileName'] # content直接存临时目录路径
self._prepare_fn = lambda: itchat_msg.download(self.content)
elif itchat_msg['Type'] == PICTURE and itchat_msg['MsgType'] == 3:
self.ctype = ContextType.IMAGE
self.content = TmpDir().path() + itchat_msg['FileName'] # content直接存临时目录路径
self._prepare_fn = lambda: itchat_msg.download(self.content)
else:
raise NotImplementedError("Unsupported message type: {}".format(itchat_msg['Type']))