From c6a5c3fb270cd045501e3ebfb2421d7c94238bac Mon Sep 17 00:00:00 2001 From: RF-Tar-Railt Date: Tue, 6 Aug 2024 16:32:03 +0800 Subject: [PATCH] :bug: fix version 0.51.0 --- src/nonebot_plugin_alconna/uniseg/adapters/onebot11/exporter.py | 2 ++ src/nonebot_plugin_alconna/uniseg/adapters/onebot12/exporter.py | 2 ++ 2 files changed, 4 insertions(+) diff --git a/src/nonebot_plugin_alconna/uniseg/adapters/onebot11/exporter.py b/src/nonebot_plugin_alconna/uniseg/adapters/onebot11/exporter.py index 78300e8..87ad6f8 100644 --- a/src/nonebot_plugin_alconna/uniseg/adapters/onebot11/exporter.py +++ b/src/nonebot_plugin_alconna/uniseg/adapters/onebot11/exporter.py @@ -62,6 +62,8 @@ async def text(self, seg: Text, bot: Union[Bot, None]) -> "MessageSegment": @export async def at(self, seg: At, bot: Union[Bot, None]) -> "MessageSegment": + if seg.flag != "user": + raise SerializeFailed(lang.require("nbp-uniseg", "invalid_segment").format(type="at", seg=seg)) return MessageSegment.at(seg.target) @export diff --git a/src/nonebot_plugin_alconna/uniseg/adapters/onebot12/exporter.py b/src/nonebot_plugin_alconna/uniseg/adapters/onebot12/exporter.py index 016a2d7..457e775 100644 --- a/src/nonebot_plugin_alconna/uniseg/adapters/onebot12/exporter.py +++ b/src/nonebot_plugin_alconna/uniseg/adapters/onebot12/exporter.py @@ -72,6 +72,8 @@ async def text(self, seg: Text, bot: Union[Bot, None]) -> "MessageSegment": @export async def at(self, seg: At, bot: Union[Bot, None]) -> "MessageSegment": + if seg.flag != "user": + raise SerializeFailed(lang.require("nbp-uniseg", "invalid_segment").format(type="at", seg=seg)) return MessageSegment.mention(seg.target) @export