Skip to content

Commit 4a3f92c

Browse files
authored
feat(matrix): add missing Matrix constant and update docs (#7368)
* feat(matrix): 添加 Matrix 平台适配器支持及更新文档 * feat(matrix): 添加 Matrix 平台图标和教程链接
1 parent 70872cd commit 4a3f92c

File tree

5 files changed

+35
-1
lines changed

5 files changed

+35
-1
lines changed

astrbot/core/pipeline/waking_check/stage.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
"qq_official_webhook": lambda e: e.get_sender_id(),
2323
"lark": lambda e: f"{e.get_sender_id()}%{e.get_group_id()}",
2424
"misskey": lambda e: f"{e.get_session_id()}_{e.get_sender_id()}",
25+
"matrix": lambda e: f"{e.get_sender_id()}_{e.get_group_id() or e.get_session_id()}",
2526
}
2627

2728

astrbot/core/star/filter/platform_adapter_type.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ class PlatformAdapterType(enum.Flag):
2222
SATORI = enum.auto()
2323
MISSKEY = enum.auto()
2424
LINE = enum.auto()
25+
MATRIX = enum.auto()
2526
ALL = (
2627
AIOCQHTTP
2728
| QQOFFICIAL
@@ -38,6 +39,7 @@ class PlatformAdapterType(enum.Flag):
3839
| SATORI
3940
| MISSKEY
4041
| LINE
42+
| MATRIX
4143
)
4244

4345

@@ -57,6 +59,7 @@ class PlatformAdapterType(enum.Flag):
5759
"satori": PlatformAdapterType.SATORI,
5860
"misskey": PlatformAdapterType.MISSKEY,
5961
"line": PlatformAdapterType.LINE,
62+
"matrix": PlatformAdapterType.MATRIX,
6063
}
6164

6265

Lines changed: 1 addition & 0 deletions
Loading

dashboard/src/utils/platformUtils.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,8 @@ export function getPlatformIcon(name) {
3838
return new URL('@/assets/images/platform_logos/misskey.png', import.meta.url).href
3939
} else if (name === 'line') {
4040
return new URL('@/assets/images/platform_logos/line.png', import.meta.url).href
41+
} else if (name === 'matrix') {
42+
return new URL('@/assets/images/platform_logos/matrix.svg', import.meta.url).href
4143
}
4244
}
4345

@@ -65,6 +67,7 @@ export function getTutorialLink(platformType) {
6567
"satori": "https://docs.astrbot.app/platform/satori/llonebot.html",
6668
"misskey": "https://docs.astrbot.app/platform/misskey.html",
6769
"line": "https://docs.astrbot.app/platform/line.html",
70+
"matrix": "https://docs.astrbot.app/platform/matrix.html",
6871
}
6972
return tutorialMap[platformType] || "https://docs.astrbot.app";
7073
}
@@ -107,6 +110,7 @@ export function getPlatformDisplayName(platformId) {
107110
vocechat: 'vocechat (VoceChat)',
108111
satori: 'satori (Satori)',
109112
line: 'line (LINE)',
113+
matrix: 'matrix (Matrix)',
110114
};
111115
return displayNameMap[platformId] || platformId;
112116
}

docs/zh/platform/matrix.md

Lines changed: 26 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,27 @@
33
> [!TIP]
44
> 该平台适配器由社区([stevessr](https://github.com/stevessr)) 维护。如果您觉得有帮助,请支持开发者,给该仓库点一个 Star。❤️
55
6+
## 部署 Matrix 服务器
7+
8+
Matrix 是一个 IM 协议,有着丰富的服务端实现。
9+
10+
请在 [Matrix Server](https://matrix.org/ecosystem/servers/)查看可用的服务端。
11+
12+
13+
14+
## 支持的基本消息类型
15+
16+
17+
| 消息类型 | 是否支持接收 | 是否支持发送 | 备注 |
18+
| ------------ | ------------ | ------------ | ---------------------------------------------- |
19+
| 文本 ||| |
20+
| 图片* ||| |
21+
| 语音* ||| |
22+
| 视频* ||| |
23+
| 文件* ||| |
24+
| 投票 ||| |
25+
*: 会持久化到本地,插件会按配置清理,在发送前会进行上传操作,超过服务器允许大小的上传将会失败
26+
627
## 安装 astrbot_plugin_matrix_adapter 插件
728

829
进入 AstrBot WebUI 的插件市场,搜索 `astrbot_plugin_matrix_adapter`,点击安装。
@@ -13,7 +34,11 @@
1334

1435
## 配置
1536

16-
请参考该仓库的 [README.md](https://github.com/stevessr/astrbot_plugin_matrix_adapter?tab=readme-ov-file#astrbot-matrix-adapter-%E6%8F%92%E4%BB%B6) 进行配置。
37+
- **`matrix_homeserver` (必填)`**: 你的 matrix 服务器实例的完整URL地址,支持域名委托自动探测。例如官方实例`https://matrix.org`
38+
- **`matrix_user_id`**: 你的 matrix 完整用户名。如 `@username:homeserver.com`
39+
- **`matrix_auth_method` (必填)** : 你的登陆方式,可选`password`,`token`,`oauth2`,`qr`推荐使用`password``oauth2/qr`模式 (oauth2/qr 模式下请确保用于认证/扫码的设备回调可以访问到 astrbot 配置的公开地址)
40+
41+
更多请参考该仓库的 [README.md](https://github.com/stevessr/astrbot_plugin_matrix_adapter?tab=readme-ov-file#astrbot-matrix-adapter-%E6%8F%92%E4%BB%B6) 进行配置。
1742

1843
## 问题提交
1944

0 commit comments

Comments
 (0)