mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-12-01 01:25:07 +08:00
🐛 fix bug in cqhttp MessageSegment
This commit is contained in:
parent
33f605a947
commit
ac87107556
@ -164,7 +164,7 @@ class MessageSegment(BaseMessageSegment["Message"]):
|
|||||||
proxy: Optional[bool] = None,
|
proxy: Optional[bool] = None,
|
||||||
timeout: Optional[int] = None) -> "MessageSegment":
|
timeout: Optional[int] = None) -> "MessageSegment":
|
||||||
if isinstance(file, BytesIO):
|
if isinstance(file, BytesIO):
|
||||||
file = file.read()
|
file = file.getvalue()
|
||||||
if isinstance(file, bytes):
|
if isinstance(file, bytes):
|
||||||
file = f"base64://{b64encode(file).decode()}"
|
file = f"base64://{b64encode(file).decode()}"
|
||||||
elif isinstance(file, Path):
|
elif isinstance(file, Path):
|
||||||
@ -212,7 +212,7 @@ class MessageSegment(BaseMessageSegment["Message"]):
|
|||||||
proxy: Optional[bool] = None,
|
proxy: Optional[bool] = None,
|
||||||
timeout: Optional[int] = None) -> "MessageSegment":
|
timeout: Optional[int] = None) -> "MessageSegment":
|
||||||
if isinstance(file, BytesIO):
|
if isinstance(file, BytesIO):
|
||||||
file = file.read()
|
file = file.getvalue()
|
||||||
if isinstance(file, bytes):
|
if isinstance(file, bytes):
|
||||||
file = f"base64://{b64encode(file).decode()}"
|
file = f"base64://{b64encode(file).decode()}"
|
||||||
elif isinstance(file, Path):
|
elif isinstance(file, Path):
|
||||||
|
Loading…
Reference in New Issue
Block a user