Skip to content

Commit 3fe2b4c

Browse files
authored
Add support for Json, Xml, and other components
1 parent 0c0f8bf commit 3fe2b4c

1 file changed

Lines changed: 12 additions & 0 deletions

File tree

astrbot/core/pipeline/respond/stage.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,18 @@ class RespondStage(Stage):
3333
Comp.Nodes: lambda comp: bool(comp.nodes), # 多个转发节点
3434
Comp.File: lambda comp: bool(comp.file_ or comp.url),
3535
Comp.WechatEmoji: lambda comp: comp.md5 is not None, # 微信表情
36+
Comp.Json: lambda comp: bool(comp.data), # Json 卡片
37+
Comp.Xml: lambda comp: bool(comp.data), # Xml 卡片
38+
Comp.Share: lambda comp: bool(comp.url) or bool(comp.title),
39+
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), # 音乐分享
40+
Comp.Forward: lambda comp: bool(comp.id), # 合并转发
41+
Comp.Location: lambda comp: bool(comp.lat and comp.lon), # 位置
42+
Comp.Contact: lambda comp: bool(comp.type and comp.id), # 推荐好友 or 群
43+
Comp.Shake: lambda _: True, # 窗口抖动(戳一戳)
44+
Comp.Anonymous: lambda _: True, # 匿名发消息
45+
Comp.Dice: lambda _: True, # 掷骰子魔法表情
46+
Comp.Rps: lambda _: True, # 猜拳魔法表情
47+
Comp.Unknown: lambda comp: bool(comp.text and comp.text.strip()),
3648
}
3749

3850
async def initialize(self, ctx: PipelineContext) -> None:

0 commit comments

Comments
 (0)