This commit is contained in:
SXP-Simon
2026-03-10 12:12:36 +08:00
@@ -257,10 +257,24 @@ class OneBotAdapter(PlatformAdapter):
)
elif seg_type == "image":
# QQ 平台: subType=1 表示表情包,通过 raw_data 传递给下游统计
sub_type = seg_data.get("subType", seg_data.get("sub_type"))
# 安全地转换为整数,防止非数字值导致异常
try:
is_sticker = int(sub_type) == 1
except (TypeError, ValueError):
is_sticker = False
# 只在 sub_type 有效时包含在 raw_data 中
raw_data: dict[str, Any] = {"summary": seg_data.get("summary", "")}
if sub_type is not None:
raw_data["sub_type"] = int(sub_type)
contents.append(
MessageContent(
type=MessageContentType.IMAGE,
type=MessageContentType.EMOJI
if is_sticker
else MessageContentType.IMAGE,
url=seg_data.get("url", seg_data.get("file", "")),
raw_data=raw_data,
)
)