Overseas access: www.kdjingpai.com
Bookmark Us

WeChatFerry is an open source WeChat robot underlying framework, created and maintained by developer lich0821 on GitHub. The project through the WeChat Hook technology , provides a set of powerful SDK , allowing developers to WeChat features with a variety of large language model ( such as ChatGPT, Gemini, DeepSeek, ChatGLM, Xunfei Starfire , Tigerbot , etc.) integrated to achieve the automation of tasks and intelligent dialogue . The core module is written in C++, supports multiple client languages (e.g. Python, Rust, Go, Java, Node.js, C#, etc.), and is adapted to specific WeChat versions (currently supporting 3.9.11.25). With its flexibility and rich features, WeChatFerry has attracted 5.5k stars and 1.1k forks, making it a popular tool for WeChat robot development.

WeChatFerry:目前集成功能较全的微信机器人开发框架-1

 

Function List

  • Send and receive messages: Supports sending text (with @), images, files, GIFs, and can listen to and receive messages.
  • Large Language Model Integration: Access to models such as ChatGPT, Gemini, DeepSeek, ChatGLM, Xunfei Starfire, etc. to realize intelligent reply or task processing.
  • Group Chat Management: Supports operations such as inviting group members and getting group information.
  • multimedia processing: Support for downloading pictures, files, decrypting pictures, and converting voice files (Silk) to MP3.
  • database access: You can query WeChat contacts, message records and other data.
  • Login Status Management: Provide functions to get login QR code, check login status, get account information (wxid, nickname, cell phone number, etc.).
  • Multi-language client: Support for client-side development in Python, Rust, Go, Java, Node.js, C# and other languages.
  • Automated tasks: Support message forwarding, timed tasks, etc., for customer service, education and other scenarios.

 

Using Help

Installation process

The use of WeChatFerry is divided into two parts: core module compilation (for developers) and client-side installation (for normal users). Below are the detailed steps:

1. Client installation (in Python, for example)

  • Installing the Python Environment: Python 3.10 is recommended, download and install it from python.org, and make sure that the pip Available.
  • Install the wcferry package: Open the command line and run:
    pip install --upgrade wcferry
  • Verify Installation: Run in Python import wcferryIf no error is reported, it is successful.

2. Core module compilation (optional for developers)

  • Preparing the environment
    • Install Visual Studio 2019 (Community Edition), which includes C++ development components.
    • Install Git for cloning repositories.
  • clone warehouse
    git clone https://github.com/lich0821/WeChatFerry.git  
    cd WeChatFerry
    
  • Compiling projects
    • Open with VS2019 WeChatFerry\WeChatFerry\WeChatFerry.sln
    • Click on "Generate" > "Generate Solution", and after compiling the solution, you can find it in the WeChatFerry\WeChatFerry\Out directory to generate sdk.dll
    • take note of: If you encounter protoc Error 9009, check Python environment or configuration protoc environment variable (requires protobuf to be installed).

3. Launch WeChat and inject

  • Prepare microsoft: Install a supported version of WeChat (e.g. 3.9.10.27 or 3.9.11.25, see Releases).
  • running example: refer to the official code for loading sdk.dll and initialized:
    import ctypes  
    sdk = ctypes.cdll.LoadLibrary("C:/path/to/WeChatFerry/WeChatFerry/Out/sdk.dll")  
    sdk.WxInitSDK(False, 10086)  # 初始化,默认端口 10086
    
  • Exiting the SDK: Run it when you're done using it sdk.WxDestroySDK()The Python process can be shut down if you want it to be a good one, and if you want it to be a good one.

Main Functions

Send and receive messages

  • Send text message
    from wcferry import Wcf  
    wcf = Wcf()  
    wcf.send_text("你好", "wxid_xxxx")  # wxid_xxxx 为目标微信 ID
    
    • Support @ someone:wcf.send_text("你好 @Tom", "roomid_xxxx")
  • receive a message
    wcf.enable_receiving_msgs()  # 开启接收  
    while True:  
    msg = wcf.get_msg()  
    if msg:  
    print(f"收到: {msg.content}")  
    wcf.disable_receiving_msgs()  # 停止接收
    

Large Language Model Integration

  • Access to ChatGPT Example(You need to configure the API Key by yourself):
    from wcferry import Wcf  
    import openai  
    wcf = Wcf()  
    openai.api_key = "your_api_key"  
    def chatgpt_reply(msg):  
    response = openai.ChatCompletion.create(  
    model="gpt-3.5-turbo",  
    messages=[{"role": "user", "content": msg.content}]  
    )  
    wcf.send_text(response.choices[0].message.content, msg.sender)  
    wcf.enable_receiving_msgs()  
    while True:  
    msg = wcf.get_msg()  
    if msg:  
    chatgpt_reply(msg)
    

multimedia processing

  • Send Picture
    wcf.send_image("C:/Pictures/test.jpg", "wxid_xxxx")
    
  • Speech to MP3: Use smc module (compilation required), set the .silk Documentation converted to .mp3
    from wcferry import smc  
    smc.silk_to_mp3("input.silk", "output.mp3")
    

Group Chat Management

  • Invited members
    wcf.invite_room_members("roomid_xxxx", ["wxid_user1", "wxid_user2"])
    
  • Get group information
    room_info = wcf.get_chatroom_info("roomid_xxxx")  
    print(room_info)
    

Example of operation flow

  1. Launch Framework: Compilation sdk.dllIf you are running a Python script, it is loaded and initialized.
  2. Log in to WeChat: Implementation wcf.get_login_qrcode() Get the QR code and scan it to log in.
  3. Configuration Features: Write scripts to implement message listening, auto-reply or group management.
  4. operational test: Run the script at the command line to check that the microsoft behavior is as expected.
  5. Debugging Optimization: If something goes wrong, you can add a debug log in VS2019 (e.g. DbgMsg("Test")), positioning issues.

Multi-language client support

caveat

  • The current version of WeChat is 3.9.11.25, which may cause injection failure.
  • Projects are for study and research purposes only and follow the MIT license.
  • Multi-opening is not supported at this time, and requires a single instance to run.
0Bookmarked
0kudos
🍐 Duck & Pear AI Article Smart Writer
Selection → Writing → Publishing
Fully automated!
WordPress AI Writing Plugin
500+ content creators are using
🎯Intelligent Selection: Batch generation, say goodbye to exhaustion
🧠retrieval enhancement: networking + knowledge base with depth
Fully automated: Writing → Mapping → Publishing
💎Permanently free: Free version = Paid version, no limitations
🔥 Download the plugin for free now!
✅ Free forever · 🔓 100% Open Source · 🔒 Local storage of data

Recommended

Can't find AI tools? Try here!

Enter keywords.Accessibility to Bing SearchYou can find AI tools on this site quickly.

Top