解析合并消息内容,当且仅当消息内容为合并转发的消息时有效
(self)
| 936 | raise FriendNotFoundError(f'未找到好友:{friend}') |
| 937 | |
| 938 | def parse(self): |
| 939 | """解析合并消息内容,当且仅当消息内容为合并转发的消息时有效""" |
| 940 | wxlog.debug(f'解析合并消息内容:{self.sender} | {self.content}') |
| 941 | self._winobj._show() |
| 942 | headcontrol = [i for i in self.control.GetFirstChildControl().GetChildren() if i.ControlTypeName == 'ButtonControl'][0] |
| 943 | RollIntoView(self.chatbox.ListControl(), headcontrol, equal=True) |
| 944 | xbias = int(headcontrol.BoundingRectangle.width()*1.5) |
| 945 | headcontrol.Click(x=xbias, simulateMove=False) |
| 946 | chatrecordwnd = uia.WindowControl(ClassName='ChatRecordWnd', searchDepth=1) |
| 947 | msgitems = chatrecordwnd.ListControl().GetChildren() |
| 948 | msgs = [] |
| 949 | for msgitem in msgitems: |
| 950 | textcontrols = [i for i in GetAllControl(msgitem) if i.ControlTypeName == 'TextControl'] |
| 951 | who = textcontrols[0].Name |
| 952 | time = textcontrols[1].Name |
| 953 | try: |
| 954 | content = textcontrols[2].Name |
| 955 | except IndexError: |
| 956 | content = '' |
| 957 | msgs.append(([who, content, ParseWeChatTime(time)])) |
| 958 | chatrecordwnd.SendKeys('{Esc}') |
| 959 | return msgs |
| 960 | |
| 961 | |
| 962 |
nothing calls this directly
no test coverage detected