解析合并消息内容,当且仅当消息内容为合并转发的消息时有效
(self)
| 825 | raise FriendNotFoundError(f'未找到好友:{friend}') |
| 826 | |
| 827 | def parse(self): |
| 828 | """解析合并消息内容,当且仅当消息内容为合并转发的消息时有效""" |
| 829 | wxlog.debug(f'解析合并消息内容:{self.sender} | {self.content}') |
| 830 | self._winobj._show() |
| 831 | headcontrol = [i for i in self.control.GetFirstChildControl().GetChildren() if i.ControlTypeName == 'ButtonControl'][0] |
| 832 | RollIntoView(self.chatbox.ListControl(), headcontrol, equal=True) |
| 833 | xbias = int(headcontrol.BoundingRectangle.width()*1.5) |
| 834 | headcontrol.Click(x=-xbias, simulateMove=False) |
| 835 | chatrecordwnd = uia.WindowControl(ClassName='ChatRecordWnd', searchDepth=1) |
| 836 | msgitems = chatrecordwnd.ListControl().GetChildren() |
| 837 | msgs = [] |
| 838 | for msgitem in msgitems: |
| 839 | textcontrols = [i for i in GetAllControl(msgitem) if i.ControlTypeName == 'TextControl'] |
| 840 | who = textcontrols[0].Name |
| 841 | time = textcontrols[1].Name |
| 842 | try: |
| 843 | content = textcontrols[2].Name |
| 844 | except IndexError: |
| 845 | content = '' |
| 846 | msgs.append(([who, content, ParseWeChatTime(time)])) |
| 847 | chatrecordwnd.SendKeys('{Esc}') |
| 848 | return msgs |
| 849 | |
| 850 | class FriendMessage(Message): |
| 851 | type = 'friend' |
nothing calls this directly
no test coverage detected