- Add wxauto package with WeChat UI automation and message handling capabilities - Implement job_extractor.py for automated job posting extraction from WeChat groups - Add job_extractor_gui.py providing graphical interface for job extraction tool - Create comprehensive documentation in Chinese covering GUI usage, multi-group support, and quick start guides - Add build configuration files (build_exe.py, build_exe.spec) for packaging as standalone executable - Include utility scripts for WeChat interaction (auto_send_msg.py, get_history.py, receive_file_transfer.py) - Add project configuration files (pyproject.toml, setup.cfg, requirements.txt) - Include test files (test_api.py, test_com_fix.py) for API and compatibility validation - Add Apache 2.0 LICENSE and comprehensive README documentation - Configure .gitignore to exclude build artifacts, logs, and temporary files
85 lines
2.2 KiB
Python
85 lines
2.2 KiB
Python
from .base import *
|
|
from wxauto.utils.tools import (
|
|
parse_wechat_time
|
|
)
|
|
|
|
class SystemMessage(BaseMessage):
|
|
attr = 'system'
|
|
|
|
def __init__(
|
|
self,
|
|
control: uia.Control,
|
|
parent: "ChatBox"
|
|
):
|
|
super().__init__(control, parent)
|
|
self.sender = 'system'
|
|
self.sender_remark = 'system'
|
|
|
|
class TickleMessage(SystemMessage):
|
|
attr = 'tickle'
|
|
|
|
def __init__(
|
|
self,
|
|
control: uia.Control,
|
|
parent: "ChatBox"
|
|
):
|
|
super().__init__(control, parent)
|
|
self.tickle_list = [
|
|
i.Name for i in
|
|
control.ListItemControl().GetParentControl().GetChildren()
|
|
]
|
|
self.content = f"[{len(self.tickle_list)}条]{self.tickle_list[0]}"
|
|
|
|
|
|
class TimeMessage(SystemMessage):
|
|
attr = 'time'
|
|
|
|
def __init__(
|
|
self,
|
|
control: uia.Control,
|
|
parent: "ChatBox"
|
|
):
|
|
super().__init__(control, parent)
|
|
self.time = parse_wechat_time(self.content)
|
|
|
|
class FriendMessage(HumanMessage):
|
|
attr = 'friend'
|
|
|
|
def __init__(
|
|
self,
|
|
control: uia.Control,
|
|
parent: "ChatBox"
|
|
):
|
|
super().__init__(control, parent)
|
|
self.head_control = self.control.ButtonControl(RegexName='.*?')
|
|
self.sender = self.head_control.Name
|
|
if (
|
|
(remark_control := self.control.TextControl()).Exists(0)
|
|
and remark_control.BoundingRectangle.top < self.head_control.BoundingRectangle.top
|
|
):
|
|
self.sender_remark = remark_control.Name
|
|
else:
|
|
self.sender_remark = self.sender
|
|
|
|
@property
|
|
def _xbias(self):
|
|
if WxParam.FORCE_MESSAGE_XBIAS:
|
|
return int(self.head_control.BoundingRectangle.width()*1.5)
|
|
return WxParam.DEFAULT_MESSAGE_XBIAS
|
|
|
|
|
|
class SelfMessage(HumanMessage):
|
|
attr = 'self'
|
|
|
|
def __init__(
|
|
self,
|
|
control: uia.Control,
|
|
parent: "ChatBox"
|
|
):
|
|
super().__init__(control, parent)
|
|
|
|
@property
|
|
def _xbias(self):
|
|
if WxParam.FORCE_MESSAGE_XBIAS:
|
|
return -int(self.head_control.BoundingRectangle.width()*1.5)
|
|
return -WxParam.DEFAULT_MESSAGE_XBIAS |