$npx -y skills add ImGoodBai/goodable --skill goodqunbotAI-powered WeChat message assistant. Retrieve recent messages from contacts/groups and send messages directly through AI chat. Windows 10/11 only. Requires WeChat PC client logged in.
| 1 | # 微信消息助手 (WeChat Message Assistant) |
| 2 | |
| 3 | This skill enables AI to interact with WeChat directly through AI chat, providing two core capabilities: retrieving recent messages and sending messages to contacts or groups. |
| 4 | |
| 5 | ## Platform Requirements |
| 6 | |
| 7 | - **OS**: Windows 10/11 only |
| 8 | - **WeChat**: WeChat PC client must be installed, running, and logged in |
| 9 | - **Python**: Python 3.11+ (automatically handled by Goodable) |
| 10 | |
| 11 | ## Core Capabilities |
| 12 | |
| 13 | ### 1. Retrieve Recent Messages |
| 14 | |
| 15 | Fetch the last 10-15 messages from any WeChat contact or group chat. |
| 16 | |
| 17 | **What you can ask:** |
| 18 | ``` |
| 19 | Get the last 15 messages from "张三" |
| 20 | Show me recent messages from "Product Team" group |
| 21 | Retrieve messages from "李四", last 10 only |
| 22 | ``` |
| 23 | |
| 24 | **What AI will do:** |
| 25 | - Opens the specified chat in WeChat |
| 26 | - Retrieves the requested number of messages (default: 15, max: 100) |
| 27 | - Returns messages with timestamp, sender, and content |
| 28 | - Formats as structured JSON for easy parsing |
| 29 | |
| 30 | ### 2. Send Messages |
| 31 | |
| 32 | Send a text message to any WeChat contact or group chat. |
| 33 | |
| 34 | **What you can ask:** |
| 35 | ``` |
| 36 | Send "Meeting at 3pm" to "张三" |
| 37 | Message "Product Team" group: "Release notes updated" |
| 38 | Tell "李四": "Please review the document" |
| 39 | ``` |
| 40 | |
| 41 | **What AI will do:** |
| 42 | - Opens the specified chat in WeChat |
| 43 | - Sends the message content |
| 44 | - Confirms successful delivery |
| 45 | |
| 46 | ## How to Use |
| 47 | |
| 48 | ### Prerequisites |
| 49 | |
| 50 | Before using this skill, ensure: |
| 51 | |
| 52 | 1. WeChat PC client is running |
| 53 | 2. You are logged into your WeChat account |
| 54 | 3. The contact/group name you specify exists in your WeChat |
| 55 | |
| 56 | ### Example Usage |
| 57 | |
| 58 | **Scenario 1: Check messages from a colleague** |
| 59 | ``` |
| 60 | User: "帮我看一下张三最近给我发了什么消息" |
| 61 | AI: [Runs get_messages.py script] |
| 62 | AI: "张三最近的5条消息: |
| 63 | 1. [2024-01-28 10:30] 张三: 会议资料已发送 |
| 64 | 2. [2024-01-28 11:00] 张三: 请查收 |
| 65 | ..." |
| 66 | ``` |
| 67 | |
| 68 | **Scenario 2: Send a message** |
| 69 | ``` |
| 70 | User: "给产品群发个消息:今天下午3点开会" |
| 71 | AI: [Runs send_message.py script] |
| 72 | AI: "消息已成功发送到产品群" |
| 73 | ``` |
| 74 | |
| 75 | ## Instructions for AI |
| 76 | |
| 77 | When the user requests WeChat message operations: |
| 78 | |
| 79 | ### 1. Retrieve Messages |
| 80 | |
| 81 | Run the get_messages.py script: |
| 82 | |
| 83 | ```bash |
| 84 | python scripts/get_messages.py "<Contact/Group Name>" [count] |
| 85 | ``` |
| 86 | |
| 87 | **Parameters:** |
| 88 | - `Contact/Group Name`: Exact name as shown in WeChat (required) |
| 89 | - `count`: Number of recent messages to retrieve (optional, default: 15, max: 100) |
| 90 | |
| 91 | **Output Format:** |
| 92 | The script returns JSON with message details: |
| 93 | ```json |
| 94 | [ |
| 95 | { |
| 96 | "time": "2024-01-28 10:30:45", |
| 97 | "sender": "张三", |
| 98 | "content": "会议资料已发送", |
| 99 | "type": "text" |
| 100 | } |
| 101 | ] |
| 102 | ``` |
| 103 | |
| 104 | **IMPORTANT - Output Formatting for User:** |
| 105 | After successfully retrieving messages, you MUST format them in a clean, readable way. DO NOT show raw JSON to the user. |
| 106 | |
| 107 | **For 5 or fewer messages** - Use a numbered list: |
| 108 | ``` |
| 109 | 📨 **张三** 的最近消息: |
| 110 | |
| 111 | 1. [2024-01-28 10:30] 张三: 会议资料已发送 |
| 112 | 2. [2024-01-28 11:00] 张三: 请查收 |
| 113 | 3. [2024-01-28 14:30] 你: 好的,已收到 |
| 114 | ``` |
| 115 | |
| 116 | |
| 117 | **Tips:** |
| 118 | - Always include contact/group name in the header |
| 119 | - Keep timestamps concise (remove date if same day) |
| 120 | - Group consecutive messages from same sender when appropriate |
| 121 | - Highlight important information if user asks for summary |
| 122 | |
| 123 | **Error Handling:** |
| 124 | - If WeChat is not running: "WeChat PC client is not running or not logged in" |
| 125 | - If contact not found: "Contact or group 'xxx' not found" |
| 126 | - Parse the error and provide user-friendly explanation in Chinese |
| 127 | |
| 128 | ### 2. Send Messages |
| 129 | |
| 130 | Run the send_message.py script: |
| 131 | |
| 132 | ```bash |
| 133 | python scripts/send_message.py "<Contact/Group Name>" "<Message Content>" |
| 134 | ``` |
| 135 | |
| 136 | **Parameters:** |
| 137 | - `Contact/Group Name`: Exact name as shown in WeChat (required) |
| 138 | - `Message Content`: Text message to send (required, cannot be empty) |
| 139 | |
| 140 | **Output:** |
| 141 | - Success: "Message sent successfully to 'xxx'" |
| 142 | - Failure: Error message with details |
| 143 | |
| 144 | **Important Notes:** |
| 145 | - Always enclose contact names and message content in quotes |
| 146 | - Contact names must match exactly as shown in WeChat |
| 147 | - For group chats, use the full group name |
| 148 | - Only text messages are supported (no images/files/emojis) |
| 149 | |
| 150 | ### 3. Best Practices |
| 151 | |
| 152 | **Name Matching:** |
| 153 | - Ask user to confirm the exact contact/group name if unsure |
| 154 | - Suggest checking WeChat contact list for correct spelling |
| 155 | - Chinese names are case-sensitive and must match exactly |
| 156 | |
| 157 | **Error Recovery:** |
| 158 | - If "WeChat not found" error: Ask user to start WeChat and log in |
| 159 | - If "Contact not found" error: Ask user to verify the name |
| 160 | - If script fails: Check if Python environment is properly set up |
| 161 | |
| 162 | **User Experience:** |
| 163 | - Summarize retrieved messages in a readable format |
| 164 | - Confirm before sending messages if content seems important |
| 165 | - Provide context about what happened after each operation |
| 166 | |
| 167 | ## Technical Details |
| 168 | |
| 169 | ### Script Locations |
| 170 | |
| 171 | ``` |
| 172 | skills/goodqunbot/ |
| 173 | ├── SKILL.md # This file |
| 174 | ├── scripts/ |
| 175 | │ ├── get_messages.py # Retrieve messages |
| 176 | │ └── send_message.py # Send messages |
| 177 | └── wxauto_lib/ # WeChat automation library (pyc bytecode) |
| 178 | ``` |
| 179 | |
| 180 | ### Impleme |