diff --git a/src/nonebot_plugin_alconna/uniseg/adapters/telegram/exporter.py b/src/nonebot_plugin_alconna/uniseg/adapters/telegram/exporter.py index 8ea9c94..8c0a43f 100644 --- a/src/nonebot_plugin_alconna/uniseg/adapters/telegram/exporter.py +++ b/src/nonebot_plugin_alconna/uniseg/adapters/telegram/exporter.py @@ -98,12 +98,13 @@ async def media(self, seg: Union[Image, Voice, Video, Audio, File], bot: Bot) -> }[name] if seg.id or seg.url: return method(seg.id or seg.url) - elif seg.path: - return method(Path(seg.path).read_bytes()) + if seg.path: + raw = Path(seg.path).read_bytes() elif seg.raw: - return method(seg.raw_bytes) + raw = seg.raw_bytes else: raise SerializeFailed(lang.require("nbp-uniseg", "invalid_segment").format(type=name, seg=seg)) + return method((seg.name, raw) if seg.name else raw) @export async def reply(self, seg: Reply, bot: Bot) -> "MessageSegment":