MCPcopy
hub / github.com/cluic/wxauto / parse

Method parse

wxauto/elements.py:827–848  ·  view source on GitHub ↗

解析合并消息内容,当且仅当消息内容为合并转发的消息时有效

(self)

Source from the content-addressed store, hash-verified

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
850class FriendMessage(Message):
851 type = 'friend'

Callers

nothing calls this directly

Calls 11

RollIntoViewFunction · 0.85
GetAllControlFunction · 0.85
ParseWeChatTimeFunction · 0.85
GetFirstChildControlMethod · 0.80
ListControlMethod · 0.80
widthMethod · 0.80
ClickMethod · 0.80
WindowControlMethod · 0.80
SendKeysMethod · 0.80
_showMethod · 0.45
GetChildrenMethod · 0.45

Tested by

no test coverage detected