From 3fe2b4c55a4c899fa4fade39f0eb05163d0f20f1 Mon Sep 17 00:00:00 2001 From: NanoRocky <76585834+NanoRocky@users.noreply.github.com> Date: Wed, 18 Feb 2026 19:46:03 +0800 Subject: [PATCH 1/6] Add support for Json, Xml, and other components --- astrbot/core/pipeline/respond/stage.py | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/astrbot/core/pipeline/respond/stage.py b/astrbot/core/pipeline/respond/stage.py index b4a7ee7fa4..99867c81ce 100644 --- a/astrbot/core/pipeline/respond/stage.py +++ b/astrbot/core/pipeline/respond/stage.py @@ -33,6 +33,18 @@ class RespondStage(Stage): Comp.Nodes: lambda comp: bool(comp.nodes), # 多个转发节点 Comp.File: lambda comp: bool(comp.file_ or comp.url), Comp.WechatEmoji: lambda comp: comp.md5 is not None, # 微信表情 + Comp.Json: lambda comp: bool(comp.data), # Json 卡片 + Comp.Xml: lambda comp: bool(comp.data), # Xml 卡片 + Comp.Share: lambda comp: bool(comp.url) or bool(comp.title), + Comp.Music: lambda comp: (comp.id and comp.type and comp.type != 'custom') or (comp.type == 'custom' and comp.url and comp.audio and comp.title), # 音乐分享 + Comp.Forward: lambda comp: bool(comp.id), # 合并转发 + Comp.Location: lambda comp: bool(comp.lat and comp.lon), # 位置 + Comp.Contact: lambda comp: bool(comp.type and comp.id), # 推荐好友 or 群 + Comp.Shake: lambda _: True, # 窗口抖动(戳一戳) + Comp.Anonymous: lambda _: True, # 匿名发消息 + Comp.Dice: lambda _: True, # 掷骰子魔法表情 + Comp.Rps: lambda _: True, # 猜拳魔法表情 + Comp.Unknown: lambda comp: bool(comp.text and comp.text.strip()), } async def initialize(self, ctx: PipelineContext) -> None: From c8de22936aa2614d5881c8eea4245d1bc92f19df Mon Sep 17 00:00:00 2001 From: NanoRocky <76585834+NanoRocky@users.noreply.github.com> Date: Wed, 18 Feb 2026 20:13:29 +0800 Subject: [PATCH 2/6] Update location check to handle None values --- astrbot/core/pipeline/respond/stage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astrbot/core/pipeline/respond/stage.py b/astrbot/core/pipeline/respond/stage.py index 99867c81ce..7c923f06f4 100644 --- a/astrbot/core/pipeline/respond/stage.py +++ b/astrbot/core/pipeline/respond/stage.py @@ -38,7 +38,7 @@ class RespondStage(Stage): Comp.Share: lambda comp: bool(comp.url) or bool(comp.title), Comp.Music: lambda comp: (comp.id and comp.type and comp.type != 'custom') or (comp.type == 'custom' and comp.url and comp.audio and comp.title), # 音乐分享 Comp.Forward: lambda comp: bool(comp.id), # 合并转发 - Comp.Location: lambda comp: bool(comp.lat and comp.lon), # 位置 + Comp.Location: lambda comp: bool(comp.lat is not None and comp.lon is not None), # 位置 Comp.Contact: lambda comp: bool(comp.type and comp.id), # 推荐好友 or 群 Comp.Shake: lambda _: True, # 窗口抖动(戳一戳) Comp.Anonymous: lambda _: True, # 匿名发消息 From 28138a2b275f364ac662e15d287ccf7181a0f39e Mon Sep 17 00:00:00 2001 From: NanoRocky <76585834+NanoRocky@users.noreply.github.com> Date: Wed, 18 Feb 2026 20:20:44 +0800 Subject: [PATCH 3/6] Update astrbot/core/pipeline/respond/stage.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- astrbot/core/pipeline/respond/stage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astrbot/core/pipeline/respond/stage.py b/astrbot/core/pipeline/respond/stage.py index 7c923f06f4..0cabbb8f88 100644 --- a/astrbot/core/pipeline/respond/stage.py +++ b/astrbot/core/pipeline/respond/stage.py @@ -43,7 +43,7 @@ class RespondStage(Stage): Comp.Shake: lambda _: True, # 窗口抖动(戳一戳) Comp.Anonymous: lambda _: True, # 匿名发消息 Comp.Dice: lambda _: True, # 掷骰子魔法表情 - Comp.Rps: lambda _: True, # 猜拳魔法表情 + Comp.RPS: lambda _: True, # 猜拳魔法表情 Comp.Unknown: lambda comp: bool(comp.text and comp.text.strip()), } From c8055a9940ce58951e894d5a0394a04cac80ab96 Mon Sep 17 00:00:00 2001 From: NanoRocky <76585834+NanoRocky@users.noreply.github.com> Date: Wed, 18 Feb 2026 20:26:41 +0800 Subject: [PATCH 4/6] Update astrbot/core/pipeline/respond/stage.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- astrbot/core/pipeline/respond/stage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astrbot/core/pipeline/respond/stage.py b/astrbot/core/pipeline/respond/stage.py index 0cabbb8f88..9ef449cf92 100644 --- a/astrbot/core/pipeline/respond/stage.py +++ b/astrbot/core/pipeline/respond/stage.py @@ -36,7 +36,7 @@ class RespondStage(Stage): Comp.Json: lambda comp: bool(comp.data), # Json 卡片 Comp.Xml: lambda comp: bool(comp.data), # Xml 卡片 Comp.Share: lambda comp: bool(comp.url) or bool(comp.title), - Comp.Music: lambda comp: (comp.id and comp.type and comp.type != 'custom') or (comp.type == 'custom' and comp.url and comp.audio and comp.title), # 音乐分享 + Comp.Music: lambda comp: (comp.id and comp._type and comp._type != 'custom') or (comp._type == 'custom' and comp.url and comp.audio and comp.title), # 音乐分享 Comp.Forward: lambda comp: bool(comp.id), # 合并转发 Comp.Location: lambda comp: bool(comp.lat is not None and comp.lon is not None), # 位置 Comp.Contact: lambda comp: bool(comp.type and comp.id), # 推荐好友 or 群 From b7a7259adc21dab3aba3e4206459f1dbaa88ede2 Mon Sep 17 00:00:00 2001 From: NanoRocky <76585834+NanoRocky@users.noreply.github.com> Date: Wed, 18 Feb 2026 20:26:57 +0800 Subject: [PATCH 5/6] Update astrbot/core/pipeline/respond/stage.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- astrbot/core/pipeline/respond/stage.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/astrbot/core/pipeline/respond/stage.py b/astrbot/core/pipeline/respond/stage.py index 9ef449cf92..6e0d2b7011 100644 --- a/astrbot/core/pipeline/respond/stage.py +++ b/astrbot/core/pipeline/respond/stage.py @@ -39,7 +39,7 @@ class RespondStage(Stage): Comp.Music: lambda comp: (comp.id and comp._type and comp._type != 'custom') or (comp._type == 'custom' and comp.url and comp.audio and comp.title), # 音乐分享 Comp.Forward: lambda comp: bool(comp.id), # 合并转发 Comp.Location: lambda comp: bool(comp.lat is not None and comp.lon is not None), # 位置 - Comp.Contact: lambda comp: bool(comp.type and comp.id), # 推荐好友 or 群 + Comp.Contact: lambda comp: bool(comp._type and comp.id), # 推荐好友 or 群 Comp.Shake: lambda _: True, # 窗口抖动(戳一戳) Comp.Anonymous: lambda _: True, # 匿名发消息 Comp.Dice: lambda _: True, # 掷骰子魔法表情 From 34e41cffb9a8f6ce48de1116e4ccabe5643c1c0f Mon Sep 17 00:00:00 2001 From: NanoRocky <76585834+NanoRocky@users.noreply.github.com> Date: Wed, 18 Feb 2026 20:27:29 +0800 Subject: [PATCH 6/6] Update astrbot/core/pipeline/respond/stage.py Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- astrbot/core/pipeline/respond/stage.py | 1 - 1 file changed, 1 deletion(-) diff --git a/astrbot/core/pipeline/respond/stage.py b/astrbot/core/pipeline/respond/stage.py index 6e0d2b7011..f9b9f37797 100644 --- a/astrbot/core/pipeline/respond/stage.py +++ b/astrbot/core/pipeline/respond/stage.py @@ -41,7 +41,6 @@ class RespondStage(Stage): Comp.Location: lambda comp: bool(comp.lat is not None and comp.lon is not None), # 位置 Comp.Contact: lambda comp: bool(comp._type and comp.id), # 推荐好友 or 群 Comp.Shake: lambda _: True, # 窗口抖动(戳一戳) - Comp.Anonymous: lambda _: True, # 匿名发消息 Comp.Dice: lambda _: True, # 掷骰子魔法表情 Comp.RPS: lambda _: True, # 猜拳魔法表情 Comp.Unknown: lambda comp: bool(comp.text and comp.text.strip()),