Skip to content

Commit 651a064

Browse files
NanoRockypizeroLOL
andauthored
fix: 修复仅发送 JSON 消息段时的空消息回复报错 (#5208)
* Fix Register_Stage · 补全 JSON 消息判断,修复发送 JSON 消息时遇到 “消息为空,跳过发送阶段” 的问题。 · 顺带补全其它消息类型判断。 Co-authored-by: Pizero <zhaory200707@outlook.com> * Fix formatting and comments in stage.py * Format stage.py --------- Co-authored-by: Pizero <zhaory200707@outlook.com>
1 parent bf3fa3e commit 651a064

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

astrbot/core/pipeline/respond/stage.py

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,21 @@ 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.Share: lambda comp: bool(comp.url) or bool(comp.title),
38+
Comp.Music: lambda comp: (
39+
(comp.id and comp._type and comp._type != "custom")
40+
or (comp._type == "custom" and comp.url and comp.audio and comp.title)
41+
), # 音乐分享
42+
Comp.Forward: lambda comp: bool(comp.id), # 合并转发
43+
Comp.Location: lambda comp: bool(
44+
comp.lat is not None and comp.lon is not None
45+
), # 位置
46+
Comp.Contact: lambda comp: bool(comp._type and comp.id), # 推荐好友 or 群
47+
Comp.Shake: lambda _: True, # 窗口抖动(戳一戳)
48+
Comp.Dice: lambda _: True, # 掷骰子魔法表情
49+
Comp.RPS: lambda _: True, # 猜拳魔法表情
50+
Comp.Unknown: lambda comp: bool(comp.text and comp.text.strip()),
3651
}
3752

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

0 commit comments

Comments
 (0)