Skip to content
This repository was archived by the owner on Mar 11, 2026. It is now read-only.

Commit c6d285a

Browse files
committed
update
1 parent 8e2f062 commit c6d285a

10 files changed

Lines changed: 246 additions & 115 deletions

File tree

.vitepress/config.mjs

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,15 @@ export default defineConfig({
7777
},
7878
{ text: "企业微信", link: "/wecom" },
7979
{ text: "微信公众平台", link: "/weixin-official-account" },
80-
{ text: "微信个人号", link: "/gewechat" },
80+
{
81+
text: "微信个人号",
82+
base: "/deploy/platform/wechat",
83+
collapsed: true,
84+
items: [
85+
{ text: "使用 WeChatPadPro", link: "/wechatpadpro" },
86+
{ text: "使用 Gewechat", link: "/gewechat" },
87+
],
88+
},
8189
{ text: "飞书", link: "/lark" },
8290
{ text: "钉钉", link: "/dingtalk" },
8391
{ text: "Telegram", link: "/telegram" },

deploy/platform/gewechat.md

Lines changed: 1 addition & 114 deletions
Original file line numberDiff line numberDiff line change
@@ -1,114 +1 @@
1-
2-
3-
# 通过 Gewechat 接入微信
4-
5-
> [!NOTE]
6-
>
7-
> 1. 这个接入方式不受微信官方支持,使用的是 [Devo919/Gewechat](https://github.com/Devo919/Gewechat)。请注意风险。如果要使用官方支持的方式,> 请使用企业微信的方式接入。
8-
>
9-
> 2. 请控制聊天频率。如果过于频繁使用(同一时间发送消息次数过多),可能会导致更高的风控风险,请注意使用频率。
10-
11-
12-
> [!WARNING]
13-
> 1. 仅支持微信个人号
14-
> 2. 微信限制,需要手动扫码登录
15-
> 3. 微信限制一个微信号必须**有一台手机在线**才能登录其他端。而 Gewechat 是一个 IPAD 微信客户端。因此,你需要有一台手机登录该微信,才能使用 Gewechat。
16-
17-
## 部署 Gewechat
18-
19-
Gewechat 只能使用 Docker 部署,如果您没有安装 Docker,请自行安装。Windows/Mac 用户请安装 `Docker Desktop`,Linux 用户请安装 `Docker`
20-
21-
最新信息请参考 [Gewechat 仓库](https://github.com/Devo919/Gewechat?tab=readme-ov-file) 部署 Gewechat。
22-
23-
### 拉取 Gewechat 镜像
24-
25-
```bash
26-
docker pull registry.cn-hangzhou.aliyuncs.com/gewe/gewe:latest
27-
docker tag registry.cn-hangzhou.aliyuncs.com/gewe/gewe gewe
28-
```
29-
30-
### 运行 Gewechat 容器
31-
32-
```bash
33-
mkdir gewechat
34-
docker run -itd -v ./gewechat:/root/temp -p 2531:2531 -p 2532:2532 --privileged=true --name=gewe gewe /usr/sbin/init
35-
```
36-
37-
如果需要开机自启,可以:
38-
39-
```bash
40-
docker update --restart=always gewe
41-
```
42-
43-
可以通过日志查看启动情况:
44-
45-
```bash
46-
docker logs gewe -f
47-
```
48-
49-
- 启动可能会花费较长时间,大概在 10-30 秒。
50-
- 如果出现 `[!!!!!!] Failed to allocate manager object, freezing.`,请参考 [AstrBot#340](https://github.com/AstrBotDevs/AstrBot/issues/340)
51-
52-
启动好后,可以通过浏览器访问 `http://localhost:2531` 查看是否正常启动。
53-
54-
## 在 AstrBot 中配置 Gewechat 适配器
55-
56-
1. 进入 AstrBot 的管理面板
57-
2. 点击左边栏 `消息平台`
58-
3. 然后在右边的界面中,点击 `+ 新增适配器`
59-
4. 选择 `gewechat`
60-
61-
弹出的配置项填写:
62-
63-
- `ID(id)`:随意填写,用于区分不同的消息平台实例。
64-
- `启用(enable)`: 勾选。
65-
- `nickname` 请随便填一个具有辨识度的英文名,不需要是微信用户名。
66-
- `base_url` 是连接到 Gewechat 后端的 API 地址。
67-
- `host` 为回调地址主机,即 gewechat 下发事件到 AstrBot 的地址。**请填写宿主机局域网地址(windows 用 ipconfig 看,linux 用 ip -a 看) 或者服务器公网地址(如果在用服务器)**
68-
- `port` 为回调地址端口,可不修改。
69-
70-
> [!NOTE]
71-
> 对于 Mac/Windows 使用 Docker Desktop 部署 AstrBot 部署的用户,base_url 请填写为 `http://host.docker.internal:2531`。并且回调地址端口不要修改。如果还不行,请通过 `docker inspect gewe` 查看 gewechat 容器网络的 IP 地址,然后 `http://ip地址:2531`
72-
>
73-
> 对于 Linux 使用 Docker 部署 AstrBot 部署的用户,请通过 `docker inspect gewe` 查看 gewechat 容器网络的 IP 地址,然后 `http://ip地址:2531`。如果有公网ip,也可填写公网 ip,需要在系统和服务器云厂商安全组(如有)放行 2531 端口。
74-
>
75-
> 对于 host,如果使用 Docker Desktop 部署 AstrBot 部署的用户,请填写为 `host.docker.internal`。如果使用 Linux 使用 Docker 部署 AstrBot 部署的用户,请通过 `docker inspect astrbot` 查看 astrbot 容器网络的 IP 地址,然后填进去。
76-
>
77-
> docker inspert:
78-
>
79-
> ![](../../source/images/gewechat/image-1.png)
80-
81-
点击 `保存`
82-
83-
- 如果出现报错 "Cannot Connect to xxxxxx:2531",请使用 `docker logs gewe` 查看 Gewechat 的日志,是否正常启动。
84-
- 如果出现报错 "创建设备失败......unexpect EOF",请关闭代理软件后重试。
85-
- 如果出现报错 "设备不存在 / 无法创建设备",请更换 AstrBot gewechat 配置里的 username 后重试。
86-
- 请确保部署 Gewechat 的机器和手机微信处于同一城市,否则可能需要验证码登录,而 Gewechat 项目目前的验证码登录功能存在异常
87-
88-
## 扫码登录
89-
90-
接下来需要查看日志。请在管理面板的 `控制台` 查看或者切终端查看。
91-
92-
查看 AstrBot 的终端日志输出,会出现相关引导提示。打开提示的二维码链接扫码登录即可。
93-
94-
95-
## 设置白名单
96-
97-
由于微信的 ID 是一段非常长的随机字符串,因此没办法通过默认设置 AstrBot 管理员的方式来设置初始会话。操作步骤如下:
98-
99-
1. 给机器人号随便发一条消息,在终端中会出现 `会话 xxx 不在会话白名单中,已终止事件传播。` 的日志(日志等级为 `INFO`)。
100-
2. 复制 `xxx` 的值。
101-
3. 在管理面板 `配置->消息平台->消息平台通用配置` 中找到 `ID 白名单`,粘贴 `xxx` 的值,回车填入。
102-
4. 点击 `保存`,等待 AstrBot 重启。
103-
5. 尝试发送 `/help` 命令,看是否有响应。
104-
105-
## 注意事项
106-
107-
一旦登录成功,请牢记在配置时配置的 username,如果更换,则相当于使用新设备登录。频繁新设备登录容易触发风控。
108-
109-
## 常见问题
110-
111-
1. Cannot connect to host xxxx:2531。请通过 `docker logs gewe` 检查 Gewechat 容器是否正常运行。
112-
2. host 回调地址异常。请参考 https://github.com/AstrBotDevs/AstrBot/issues/327
113-
3. 创建设备失败。请重启 gewe 容器几次再看情况。如果还不行就等一段时间之后再尝试。
114-
4. 设备 id 不存在。请修改 AstrBot 配置,将 gewechat 的配置中的 username 随便改一个名字后保存重启。
1+
本页面已经迁移至 [Gewechat](/deploy/platform/wechat/gewechat)

deploy/platform/wechat/gewechat.md

Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
2+
3+
# 通过 Gewechat 接入微信
4+
5+
> [!WARNING]
6+
> 该方法不可用,请切换至其他方法,如 [WeChatPadPro](/deploy/platform/wechat/wechatpadpro)
7+
8+
9+
## 部署 Gewechat
10+
11+
Gewechat 只能使用 Docker 部署,如果您没有安装 Docker,请自行安装。Windows/Mac 用户请安装 `Docker Desktop`,Linux 用户请安装 `Docker`
12+
13+
最新信息请参考 [Gewechat 仓库](https://github.com/Devo919/Gewechat?tab=readme-ov-file) 部署 Gewechat。
14+
15+
### 拉取 Gewechat 镜像
16+
17+
```bash
18+
docker pull registry.cn-hangzhou.aliyuncs.com/gewe/gewe:latest
19+
docker tag registry.cn-hangzhou.aliyuncs.com/gewe/gewe gewe
20+
```
21+
22+
### 运行 Gewechat 容器
23+
24+
```bash
25+
mkdir gewechat
26+
docker run -itd -v ./gewechat:/root/temp -p 2531:2531 -p 2532:2532 --privileged=true --name=gewe gewe /usr/sbin/init
27+
```
28+
29+
如果需要开机自启,可以:
30+
31+
```bash
32+
docker update --restart=always gewe
33+
```
34+
35+
可以通过日志查看启动情况:
36+
37+
```bash
38+
docker logs gewe -f
39+
```
40+
41+
- 启动可能会花费较长时间,大概在 10-30 秒。
42+
- 如果出现 `[!!!!!!] Failed to allocate manager object, freezing.`,请参考 [AstrBot#340](https://github.com/AstrBotDevs/AstrBot/issues/340)
43+
44+
启动好后,可以通过浏览器访问 `http://localhost:2531` 查看是否正常启动。
45+
46+
## 在 AstrBot 中配置 Gewechat 适配器
47+
48+
1. 进入 AstrBot 的管理面板
49+
2. 点击左边栏 `消息平台`
50+
3. 然后在右边的界面中,点击 `+ 新增适配器`
51+
4. 选择 `gewechat`
52+
53+
弹出的配置项填写:
54+
55+
- `ID(id)`:随意填写,用于区分不同的消息平台实例。
56+
- `启用(enable)`: 勾选。
57+
- `nickname` 请随便填一个具有辨识度的英文名,不需要是微信用户名。
58+
- `base_url` 是连接到 Gewechat 后端的 API 地址。
59+
- `host` 为回调地址主机,即 gewechat 下发事件到 AstrBot 的地址。**请填写宿主机局域网地址(windows 用 ipconfig 看,linux 用 ip -a 看) 或者服务器公网地址(如果在用服务器)**
60+
- `port` 为回调地址端口,可不修改。
61+
62+
> [!NOTE]
63+
> 对于 Mac/Windows 使用 Docker Desktop 部署 AstrBot 部署的用户,base_url 请填写为 `http://host.docker.internal:2531`。并且回调地址端口不要修改。如果还不行,请通过 `docker inspect gewe` 查看 gewechat 容器网络的 IP 地址,然后 `http://ip地址:2531`
64+
>
65+
> 对于 Linux 使用 Docker 部署 AstrBot 部署的用户,请通过 `docker inspect gewe` 查看 gewechat 容器网络的 IP 地址,然后 `http://ip地址:2531`。如果有公网ip,也可填写公网 ip,需要在系统和服务器云厂商安全组(如有)放行 2531 端口。
66+
>
67+
> 对于 host,如果使用 Docker Desktop 部署 AstrBot 部署的用户,请填写为 `host.docker.internal`。如果使用 Linux 使用 Docker 部署 AstrBot 部署的用户,请通过 `docker inspect astrbot` 查看 astrbot 容器网络的 IP 地址,然后填进去。
68+
>
69+
> docker inspert:
70+
>
71+
> ![](../../source/images/gewechat/image-1.png)
72+
73+
点击 `保存`
74+
75+
- 如果出现报错 "Cannot Connect to xxxxxx:2531",请使用 `docker logs gewe` 查看 Gewechat 的日志,是否正常启动。
76+
- 如果出现报错 "创建设备失败......unexpect EOF",请关闭代理软件后重试。
77+
- 如果出现报错 "设备不存在 / 无法创建设备",请更换 AstrBot gewechat 配置里的 username 后重试。
78+
- 请确保部署 Gewechat 的机器和手机微信处于同一城市,否则可能需要验证码登录,而 Gewechat 项目目前的验证码登录功能存在异常
79+
80+
## 扫码登录
81+
82+
接下来需要查看日志。请在管理面板的 `控制台` 查看或者切终端查看。
83+
84+
查看 AstrBot 的终端日志输出,会出现相关引导提示。打开提示的二维码链接扫码登录即可。
85+
86+
87+
## 设置白名单
88+
89+
由于微信的 ID 是一段非常长的随机字符串,因此没办法通过默认设置 AstrBot 管理员的方式来设置初始会话。操作步骤如下:
90+
91+
1. 给机器人号随便发一条消息,在终端中会出现 `会话 xxx 不在会话白名单中,已终止事件传播。` 的日志(日志等级为 `INFO`)。
92+
2. 复制 `xxx` 的值。
93+
3. 在管理面板 `配置->消息平台->消息平台通用配置` 中找到 `ID 白名单`,粘贴 `xxx` 的值,回车填入。
94+
4. 点击 `保存`,等待 AstrBot 重启。
95+
5. 尝试发送 `/help` 命令,看是否有响应。
96+
97+
## 注意事项
98+
99+
一旦登录成功,请牢记在配置时配置的 username,如果更换,则相当于使用新设备登录。频繁新设备登录容易触发风控。
100+
101+
## 常见问题
102+
103+
1. Cannot connect to host xxxx:2531。请通过 `docker logs gewe` 检查 Gewechat 容器是否正常运行。
104+
2. host 回调地址异常。请参考 https://github.com/AstrBotDevs/AstrBot/issues/327
105+
3. 创建设备失败。请重启 gewe 容器几次再看情况。如果还不行就等一段时间之后再尝试。
106+
4. 设备 id 不存在。请修改 AstrBot 配置,将 gewechat 的配置中的 username 随便改一个名字后保存重启。
Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
2+
# 通过 WeChatPadPro 接入微信
3+
4+
**需要 AstrBot 版本 >= 3.5.10**
5+
6+
> [!NOTE]
7+
>
8+
> 1. 这个接入方式不受微信官方支持,请注意风险。**我们建议使用受微信官方支持的方式,即使用企业微信、微信客服、微信公众号方式接入**
9+
>
10+
> 2. 请控制聊天频率。如果过于频繁使用(同一时间发送消息次数过多),可能会导致更高的风控风险,请注意使用频率。
11+
12+
> [!WARNING]
13+
> 1. 仅支持微信个人号
14+
> 2. 微信限制,需要手动扫码登录
15+
> 3. 微信限制一个微信号必须**有一台手机在线**才能登录其他端。因此,你需要有一台手机登录该微信,才能使用该接入方式。请尽量保证手机和部署地设备处于同一城市。
16+
17+
18+
## 部署 WeChatPadPro
19+
20+
有两种部署方式:
21+
22+
- 不通过 Docker 部署
23+
- 通过 Docker 部署
24+
25+
### 不通过 Docker 部署
26+
27+
打开 [WeChatPadPro](https://github.com/luolin-ai/WeChatPadPro),请按照其 README 提供的部署方式部署。一般来说,最终你会部署一下三个软件:
28+
29+
- MySQL
30+
- Redis
31+
- WeChatPadPro
32+
33+
并且可以通过 `http://ip:port`(ip 是 localhost 或你的公网 IP;port 是 `asset/setting.json` 中你定义的 `port` 中的端口号)打开如下页面:
34+
35+
![](../../../source/images/wechatpadpro/image.png)
36+
37+
AstrBot 的成功接入依赖于您是否能够打开这个页面。
38+
39+
### 通过 Docker 部署
40+
41+
仅在 Linux 上测试了部署的成功性。
42+
43+
> [!TIP]
44+
> 不支持 `arm64` 架构的设备。
45+
46+
```bash
47+
git clone https://github.com/bclz-wyz/WeChatPadPro-Docker --depth 1
48+
cd WeChatPadPro-Docker
49+
mkdir main && mkdir mysql && cd main
50+
git clone https://github.com/luolin-ai/WeChatPadPro --depth 1
51+
mv WeChatPadPro/* . # 需要将 WeChatPadPro 内所有文件放到 main 文件夹下
52+
unzip 859_service_linux.zip # 这一步会释出 stay 可执行文件
53+
cd .. # 回到 WeChatPadPro-Docker 目录
54+
mv setting.json main/assets/setting.json # 覆盖 WeChatPadPro 原来的 setting.json 文件。
55+
```
56+
57+
你可以根据你的需要,编辑 `main/assets/setting.json` 文件,也可以不编辑。建议将 `adminKey` 修改为更安全的密码。
58+
59+
接下来,运行容器。
60+
61+
```bash
62+
docker compose up -d && docker logs wechatpadpro
63+
```
64+
65+
正常情况下,会出现如下日志:
66+
67+
```
68+
版本号: v20250515.00
69+
WeChatPadPro
70+
🚀 基于 WeChat Pad 协议的高级微信管理工具 🚀
71+
...
72+
...
73+
如有任何问题或建议,欢迎通过 GitHub Issues 或邮件与我们联系。
74+
======== ADMIN_KEY === ****** ========
75+
connect MySQL success
76+
auto create MySQL tables success
77+
connect Redis success
78+
updateApiVersion success
79+
```
80+
81+
如果你发现出现了报错:
82+
83+
![failed to connect MySQL: dial tcp xxx:3306: connect: connection refused](../../../source/images/wechatpadpro/image-2.png)
84+
85+
这是因为 MySQL 容器还没有启动成功。
86+
87+
88+
请执行 `docker ps` 查看另外两个容器 `wx_redis``wx_mysql` 是否 healthy。
89+
90+
![](../../../source/images/wechatpadpro/image-3.png)
91+
92+
在 healthy 后,重启 `wechatpadpro` 容器:
93+
94+
```bash
95+
docker restart wechatpadpro
96+
```
97+
98+
## 接入 AstrBot
99+
100+
成功部署后,进入 AstrBot WebUI:
101+
102+
打开消息平台 -> 新增适配器 -> wechatpadpro(微信)。
103+
104+
![](../../../source/images/wechatpadpro/image-4.png)
105+
106+
- admin_key: 上面步骤中,`setting.json` 下的 `adminKey` 的值。
107+
- host 和 port:取决于你的部署情况。host 填写部署 WeChatPadPro 项目的机器的主机地址。port 填写 `setting.json` 中的 port。如果是 WeChatPadPro-Docker 部署,默认映射到了 38849 端口,如您没修改,填写这个端口即可。
108+
109+
填写完成后,点击保存。
110+
111+
进入`控制台`,查看日志,如果连接成功,会出现如下日志:
112+
113+
```
114+
[12:50:16] [Core] [INFO] [wechatpadpro.wechatpadpro_adapter:69]: WeChatPadPro 设备不在线或无可用凭据,开始扫码登录流程。
115+
[12:50:16] [Core] [INFO] [wechatpadpro.wechatpadpro_adapter:189]: 成功获取授权码
116+
[12:50:16] [Core] [INFO] [wechatpadpro.wechatpadpro_adapter:81]: 请扫描以下二维码登录: https://api.pwmqr.com/qrcode/create/?url=http://weixin.qq.com/x/xxx
117+
[12:50:16] [Core] [INFO] [wechatpadpro.wechatpadpro_adapter:251]: 请在 30 秒内扫码登录!!!
118+
```
119+
120+
请打开微信扫码即可,如果超出了 30 秒,重新关开这个平台适配器即可:
121+
122+
![](../../../source/images/wechatpadpro/image-5.png)
123+
124+
## 常见问题
125+
126+
### 接收不到消息!!!
127+
128+
1. 检查 WeChatPadPro 是否正常启动
129+
2. 检查 AstrBot WebUI 控制台日志,是否有与 WeChatPadPro 相关的报错
130+
3. 如果一切无误,请尝试在平台适配器配置中启用 `是否启用主动消息轮询`
35.6 KB
Loading
7.35 KB
Loading
17.7 KB
Loading
36 KB
Loading
15.1 KB
Loading
72.4 KB
Loading

0 commit comments

Comments
 (0)