Docker中运行的微信机器人API
本项目主要是为了没有Windows Server服务器的用户使用ntchat搭建微信机器人, 仅支持
linux/amd64
(不支持arm), 其它系统不保证能运行
docker run -d \
--privileged \
--security-opt seccomp=unconfined \
--hostname="$(hostname)" \
--env="RDP_SERVER=yes" \
--publish="3389:3389/tcp" \
--publish="8000:8000/tcp" \
--add-host=dldir1.qq.com:127.0.0.1 \
zhuweiyou/ntchat-api:latest
使用 Microsoft Remote Desktop
远程连接 ip:3389
用户名和密码均为 wineuser
打开桌面的Home
文件夹, 找到 [email protected]/fastapi_example/main.py
双击运行它(如果不行,则右击打开方式选择Open With Python)
# 你也可以用终端运行, 但实测终端界面运行容易卡死, 建议上面的方式运行
# 打开终端后:
cd [email protected]/fastapi_example
wine python main.py
或者安装 pm2 之类的, 你喜欢的工具来运行
查看API文档 http://ip:8000/docs
用你的程序或Postman请求:
-
POST http://ip:8000/client/create 获得
guid
存下来, 后续所有请求都带上 -
POST http://ip:8000/client/open 此时远程界面应该会自动启动WeChat.exe(PC微信进程)
{
"guid": "第1步获得的guid",
"smart": true
}
{
"guid": "第1步获得的guid",
"callback_url": "你的程序接收消息回调的地址"
}
由于我懒得重新做一个镜像, 可参考这里解决 #2