From 15a1c4907a3a0fc986861766eb4de7ed483690a6 Mon Sep 17 00:00:00 2001 From: stevessr Date: Sun, 5 Apr 2026 10:30:30 +0800 Subject: [PATCH 1/2] =?UTF-8?q?feat(matrix):=20=E6=B7=BB=E5=8A=A0=20Matrix?= =?UTF-8?q?=20=E5=B9=B3=E5=8F=B0=E9=80=82=E9=85=8D=E5=99=A8=E6=94=AF?= =?UTF-8?q?=E6=8C=81=E5=8F=8A=E6=9B=B4=E6=96=B0=E6=96=87=E6=A1=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- astrbot/core/pipeline/waking_check/stage.py | 1 + .../core/star/filter/platform_adapter_type.py | 3 +++ docs/zh/platform/matrix.md | 19 ++++++++++++++++++- 3 files changed, 22 insertions(+), 1 deletion(-) diff --git a/astrbot/core/pipeline/waking_check/stage.py b/astrbot/core/pipeline/waking_check/stage.py index 2dcb840e91..ddc2a6cb83 100644 --- a/astrbot/core/pipeline/waking_check/stage.py +++ b/astrbot/core/pipeline/waking_check/stage.py @@ -22,6 +22,7 @@ "qq_official_webhook": lambda e: e.get_sender_id(), "lark": lambda e: f"{e.get_sender_id()}%{e.get_group_id()}", "misskey": lambda e: f"{e.get_session_id()}_{e.get_sender_id()}", + "matrix": lambda e: f"{e.get_sender_id()}_{e.get_group_id() or e.get_session_id()}", } diff --git a/astrbot/core/star/filter/platform_adapter_type.py b/astrbot/core/star/filter/platform_adapter_type.py index 3ac8019ef8..55043cbe33 100644 --- a/astrbot/core/star/filter/platform_adapter_type.py +++ b/astrbot/core/star/filter/platform_adapter_type.py @@ -22,6 +22,7 @@ class PlatformAdapterType(enum.Flag): SATORI = enum.auto() MISSKEY = enum.auto() LINE = enum.auto() + MATRIX = enum.auto() ALL = ( AIOCQHTTP | QQOFFICIAL @@ -38,6 +39,7 @@ class PlatformAdapterType(enum.Flag): | SATORI | MISSKEY | LINE + | MATRIX ) @@ -57,6 +59,7 @@ class PlatformAdapterType(enum.Flag): "satori": PlatformAdapterType.SATORI, "misskey": PlatformAdapterType.MISSKEY, "line": PlatformAdapterType.LINE, + "matrix": PlatformAdapterType.MATRIX, } diff --git a/docs/zh/platform/matrix.md b/docs/zh/platform/matrix.md index 822ce853de..60a757fbb1 100644 --- a/docs/zh/platform/matrix.md +++ b/docs/zh/platform/matrix.md @@ -3,6 +3,19 @@ > [!TIP] > 该平台适配器由社区([stevessr](https://github.com/stevessr)) 维护。如果您觉得有帮助,请支持开发者,给该仓库点一个 Star。❤️ +## 支持的基本消息类型 + + +| 消息类型 | 是否支持接收 | 是否支持发送 | 备注 | +| ------------ | ------------ | ------------ | ---------------------------------------------- | +| 文本 | 是 | 是 | | +| 图片* | 是 | 是 | | +| 语音* | 是 | 是 | | +| 视频* | 是 | 是 | | +| 文件* | 是 | 是 | | +| 投票 | 是 | 否 | | +*: 会持久化到本地,插件会按配置清理,在发送前会进行上传操作,超过服务器允许大小的上传将会失败 + ## 安装 astrbot_plugin_matrix_adapter 插件 进入 AstrBot WebUI 的插件市场,搜索 `astrbot_plugin_matrix_adapter`,点击安装。 @@ -13,7 +26,11 @@ ## 配置 -请参考该仓库的 [README.md](https://github.com/stevessr/astrbot_plugin_matrix_adapter?tab=readme-ov-file#astrbot-matrix-adapter-%E6%8F%92%E4%BB%B6) 进行配置。 +- **`matrix_homeserver` (必填)`**: 你的 matrix 服务器实例的完整URL地址,支持域名委托自动探测。例如官方实例`https://matrix.org` +- **`matrix_user_id`**: 你的 matrix 完整用户名。如 `@username:homeserver.com` +- **`matrix_auth_method` (必填)** : 你的登陆方式,可选`password`,`token`,`oauth2`,`qr`推荐使用`password`或`oauth2/qr`模式 (oauth2/qr 模式下请确保用于认证/扫码的设备回调可以访问到 astrbot 配置的公开地址) + +更多请参考该仓库的 [README.md](https://github.com/stevessr/astrbot_plugin_matrix_adapter?tab=readme-ov-file#astrbot-matrix-adapter-%E6%8F%92%E4%BB%B6) 进行配置。 ## 问题提交 From 21c158abc8537182db4009679da1d2d3fb6badf6 Mon Sep 17 00:00:00 2001 From: stevessr Date: Sun, 5 Apr 2026 11:50:27 +0800 Subject: [PATCH 2/2] =?UTF-8?q?feat(matrix):=20=E6=B7=BB=E5=8A=A0=20Matrix?= =?UTF-8?q?=20=E5=B9=B3=E5=8F=B0=E5=9B=BE=E6=A0=87=E5=92=8C=E6=95=99?= =?UTF-8?q?=E7=A8=8B=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- dashboard/src/assets/images/platform_logos/matrix.svg | 1 + dashboard/src/utils/platformUtils.js | 4 ++++ docs/zh/platform/matrix.md | 8 ++++++++ 3 files changed, 13 insertions(+) create mode 100644 dashboard/src/assets/images/platform_logos/matrix.svg diff --git a/dashboard/src/assets/images/platform_logos/matrix.svg b/dashboard/src/assets/images/platform_logos/matrix.svg new file mode 100644 index 0000000000..b8e64eccc9 --- /dev/null +++ b/dashboard/src/assets/images/platform_logos/matrix.svg @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/dashboard/src/utils/platformUtils.js b/dashboard/src/utils/platformUtils.js index 384b204aa4..ae39396d77 100644 --- a/dashboard/src/utils/platformUtils.js +++ b/dashboard/src/utils/platformUtils.js @@ -38,6 +38,8 @@ export function getPlatformIcon(name) { return new URL('@/assets/images/platform_logos/misskey.png', import.meta.url).href } else if (name === 'line') { return new URL('@/assets/images/platform_logos/line.png', import.meta.url).href + } else if (name === 'matrix') { + return new URL('@/assets/images/platform_logos/matrix.svg', import.meta.url).href } } @@ -65,6 +67,7 @@ export function getTutorialLink(platformType) { "satori": "https://docs.astrbot.app/platform/satori/llonebot.html", "misskey": "https://docs.astrbot.app/platform/misskey.html", "line": "https://docs.astrbot.app/platform/line.html", + "matrix": "https://docs.astrbot.app/platform/matrix.html", } return tutorialMap[platformType] || "https://docs.astrbot.app"; } @@ -107,6 +110,7 @@ export function getPlatformDisplayName(platformId) { vocechat: 'vocechat (VoceChat)', satori: 'satori (Satori)', line: 'line (LINE)', + matrix: 'matrix (Matrix)', }; return displayNameMap[platformId] || platformId; } diff --git a/docs/zh/platform/matrix.md b/docs/zh/platform/matrix.md index 60a757fbb1..5a1ae0bbb7 100644 --- a/docs/zh/platform/matrix.md +++ b/docs/zh/platform/matrix.md @@ -3,6 +3,14 @@ > [!TIP] > 该平台适配器由社区([stevessr](https://github.com/stevessr)) 维护。如果您觉得有帮助,请支持开发者,给该仓库点一个 Star。❤️ +## 部署 Matrix 服务器 + +Matrix 是一个 IM 协议,有着丰富的服务端实现。 + +请在 [Matrix Server](https://matrix.org/ecosystem/servers/)查看可用的服务端。 + + + ## 支持的基本消息类型