How littlecodersh/itchat works
itchat is a Python client library for operating a personal WeChat account: users log in, register message handlers, run a receive loop, and can send replies or perform contact and chatroom operations. The map also includes login-state persistence, message/file handling, contact and session state, and the library’s user-facing value models. Source excerpts are partial, so some documented capabilities are shown without inferred internal call chains; dashed links mark relationships whose implementation was not verified.
Main entry points: messages.py Message operations · core.py Core client · contact.py Contacts and chats · __init__.py Client state
Components 17
Public API
- itchat API
itchat/__init__.py - Core client
itchat/core.py
Account and Contacts
- Login and sync
itchat/components/login.py - Session persistence
itchat/components/hotreload.py - Contacts and chats
itchat/components/contact.py
Messaging
- Handler registration
itchat/components/register.py - Message operations
itchat/components/messages.py - Message types
itchat/content.py
Runtime State
- Client state
itchat/storage/__init__.py - Message queue
itchat/storage/messagequeue.py - User and chat models
itchat/storage/templates.py - API results
itchat/returnvalues.py - Client configuration
itchat/config.py - Protocol utilities
itchat/utils.py - Logging
itchat/log.py
Other components
- Application developer
- WeChat service
Connections 28
- Application developer → itchat API: calls
README.md - itchat API → Core client: creates client
itchat/__init__.py - Core client → Login and sync: delegates login
itchat/core.py - Core client → Contacts and chats: delegates contacts
itchat/core.py - Core client → Message operations: delegates messaging
itchat/core.py - Core client → Handler registration: delegates handlers
- Login and sync → WeChat service: authenticates and syncs
itchat/components/login.py - Login and sync → Client state: updates session state
itchat/components/login.py - Login and sync → Contacts and chats: uses contact updates
itchat/components/login.py - Session persistence → Client state: saves and restores
itchat/components/hotreload.py - Session persistence → Message operations: queues recovered messages
itchat/components/hotreload.py - Contacts and chats → WeChat service: fetches and changes contacts
itchat/components/contact.py - Contacts and chats → Client state: updates local contacts
itchat/components/contact.py - Message operations → WeChat service: sends and downloads
itchat/components/messages.py - Message operations → Client state: looks up chat state
itchat/components/messages.py - Handler registration → Application developer: accepts callbacks
README.md - Handler registration → Message operations: dispatches handlers
- itchat API → Message types: exposes types
itchat/__init__.py - Client state → Message queue: holds messages
itchat/storage/__init__.py - Client state → User and chat models: builds contact models
itchat/storage/__init__.py - User and chat models → Core client: delegates user actions
itchat/storage/templates.py - Message operations → API results: returns status
itchat/components/messages.py - Contacts and chats → API results: returns status
itchat/components/contact.py - Login and sync → Client configuration: uses settings
itchat/components/login.py - Message operations → Client configuration: uses settings
itchat/components/messages.py - Contacts and chats → Protocol utilities: formats and searches
itchat/components/contact.py - Handler registration → Protocol utilities: uses helpers
itchat/components/register.py - itchat API → Logging: exposes logging
itchat/__init__.py