How claw-codes/wx4py works
wx4py automates the Windows WeChat 4.x desktop client through UI Automation. The main workflow is to connect a client, perform chat or group-management operations, or process group messages through a listener, handlers, and serialized actions. Documented capabilities also include message forwarding, AI-assisted replies, chat-history inspection, and group administration. Edges follow the supplied excerpts, source-index references, or README; some feature internals were not sampled, so those relationships are omitted rather than inferred.
Main entry points: chat.py Chat operations · client.py WeChatClient · groups.py Group management · window.py Window manager
Components 20
Client and sessions
- WeChatClient
src/client.py
Desktop automation
- Window manager
src/core/window.py - UIA wrapper
src/core/uia_wrapper.py - UI Automation
src/core/uiautomation.py - Windows controls
src/core/win32.py - Tray handling
src/core/tray.py
WeChat features
- Page base
src/features/base.py - Chat operations
src/features/chat.py - Group management
src/features/groups.py
Message processing
- Group processor
src/features/messaging/processor.py - Message listener
src/features/messaging/listener.py - Forward rules
src/features/messaging/forwarder.py - AI integration
src/ai.py
Configuration and support
- Runtime settings
src/config.py - Logging and audit
src/utils/logger.py - Error types
src/core/exceptions.py - Clipboard utilities
src/utils/clipboard_utils.py - Markdown utilities
src/utils/markdown_utils.py
Other components
- Python caller
- WeChat desktop
Connections 29
- Python caller → WeChatClient: creates client
README.md - WeChatClient → Window manager: connects window
src/client.py - WeChatClient → Chat operations: creates chat API
src/client.py - WeChatClient → Group management: creates group API
src/client.py - WeChatClient → Group processor: starts processing
src/client.py - Window manager → WeChat desktop: controls desktop
README.md - Window manager → UIA wrapper: initializes UIA
src/core/window.py - Window manager → Windows controls: uses window controls
src/core/window.py - Window manager → Tray handling: restores from tray
src/core/window.py - UIA wrapper → UI Automation: wraps automation
src/core/uia_wrapper.py - Chat operations → Page base: inherits page behavior
src/features/chat.py - Group management → Page base: inherits page behavior
src/features/groups.py - Group management → Chat operations: uses chat operations
src/features/groups.py - Chat operations → Clipboard utilities: uses clipboard
src/features/chat.py - Group management → Markdown utilities: formats announcements
src/features/groups.py - Group processor → Message listener: starts listener
src/features/messaging/processor.py - Message listener → UI Automation: reads UI controls
src/features/messaging/listener.py - Group processor → Chat operations: sends actions
src/features/messaging/processor.py - Forward rules → Group processor: emits forward actions
src/features/messaging/forwarder.py - AI integration → Message listener: uses message events
src/ai.py - Python caller → Group management: manages groups
README.md - Python caller → Chat operations: sends and inspects chats
README.md - Python caller → Forward rules: configures forwarding
README.md - Python caller → AI integration: configures AI replies
README.md - Chat operations → Logging and audit: logs operations
src/features/chat.py - Group management → Logging and audit: logs operations
src/features/groups.py - WeChatClient → Error types: raises connection error
src/client.py - Runtime settings → Logging and audit: configures logging
src/utils/logger.py - Page base → Windows controls: minimizes window
src/features/base.py