🔀 Merge pull request #509

MessageSegment.image 的 BytesIO
This commit is contained in:
Mix
2021-08-23 00:26:03 +08:00
committed by GitHub
3 changed files with 23 additions and 1 deletions

View File

@ -89,7 +89,7 @@ class MessageSegment(BaseMessageSegment["Message"]):
proxy: bool = True,
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):