让 AstrBot 接上微信:wxauto_repost 微信适配版
微信 3.9 被强制升级之后,老方案全线失效。这个补丁把底层换成
wechatauto-replica,让 AstrBot 在微信 PC 4.1.12+ 上重新收发消息。
背景
上游插件 wxauto_repost 依赖 wxauto,而 wxauto 只支持微信 3.9 及更早版本。随着 3.9 被官方强制升级拦截,老方案集体失效。
本仓库是 wxauto-repost-onebotv11 的二改版(原作者:汐灿),核心改动:
- 底层库由
wxauto换成 wechatauto-replica(支持微信 4.1.12+,Apache-2.0); -
修复换库后暴露的 12 处问题(逐条见仓库
PATCHES.md)。 -
项目地址:https://github.com/yukangxi/wxauto-repost-onebotv11-restoredversion
能做什么
让 AstrBot 与微信 PC 端双向收发消息,支持私聊与群聊,经由 OneBot v11 协议对接。
支持环境
| 项 | 要求 |
|---|---|
| 系统 | 仅 Windows 10 / 11(x64) |
| 微信 | PC 版 4.1.12+(实测 4.1.15.13) |
| AstrBot | ≥ 3.0.0 |
| Python | 3.10+(实测 3.12) |
不支持:Linux / macOS / Android、微信 3.9 及以下、无桌面的服务器。
安装(简要)
- 把插件放进
<AstrBot>/core/data/plugins/wxauto_repost/; pip install -r requirements.txt;- AstrBot 面板 → 平台 → 新增 aiocqhttp,反向 WS 端口
7799; - 打开插件面板
http://127.0.0.1:10001,填monitor_users(要监听的微信昵称),点「启动服务」。
Releases 里也提供了内置 wheels 的离线包:
pip install --no-index --find-links wheels -r requirements.txt。
依赖
只需 6 个(其余由 AstrBot 提供):
wechatauto-replica>=1.2.4、flask、flask-cors、websocket-client、requests、pywin32
⚠️ 最容易踩的坑:桌面
微信 PC 版的「发送」依赖屏幕截图定位输入框,所以必须存在一个「正在渲染」的桌面:
| 场景 | 能否收发 |
|---|---|
| 连着远程桌面 | ✅ |
| 断开远程桌面 | ❌ 截屏失败,发不出去 |
| 无头服务器 | ❌ |
解决思路是 虚拟显示器 + 会话保活,两者缺一不可。仓库 system/ 目录里给了脚本:
cd system
powershell -ExecutionPolicy Bypass -File 1-install-vdd.ps1 -Download # 装虚拟显示器
powershell -ExecutionPolicy Bypass -File 2-register-task.ps1 # 会话保活
powershell -ExecutionPolicy Bypass -File 3-verify.ps1 # 自检
许可
本仓库为修改版(Fork),许可请以原仓库为准(原仓库暂无 LICENSE)。使用前请阅读仓库内的 LICENSE-NOTICE.md。