From ac871075560e9a5e3a9654ffb2080cc1c79ef4ad Mon Sep 17 00:00:00 2001 From: AkiraXie Date: Sun, 3 Oct 2021 23:20:17 +0800 Subject: [PATCH] :bug: fix bug in cqhttp MessageSegment --- .../nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/message.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/message.py b/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/message.py index 42cbc8ac..19803cf3 100644 --- a/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/message.py +++ b/packages/nonebot-adapter-cqhttp/nonebot/adapters/cqhttp/message.py @@ -164,7 +164,7 @@ class MessageSegment(BaseMessageSegment["Message"]): proxy: Optional[bool] = None, timeout: Optional[int] = None) -> "MessageSegment": if isinstance(file, BytesIO): - file = file.read() + file = file.getvalue() if isinstance(file, bytes): file = f"base64://{b64encode(file).decode()}" elif isinstance(file, Path): @@ -212,7 +212,7 @@ class MessageSegment(BaseMessageSegment["Message"]): proxy: Optional[bool] = None, timeout: Optional[int] = None) -> "MessageSegment": if isinstance(file, BytesIO): - file = file.read() + file = file.getvalue() if isinstance(file, bytes): file = f"base64://{b64encode(file).decode()}" elif isinstance(file, Path):