Skip to content

Commit

Permalink
🐛 version 0.10.1
Browse files Browse the repository at this point in the history
fix resource segment init
  • Loading branch information
RF-Tar-Railt committed Mar 6, 2024
1 parent 1c72553 commit 5412714
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
8 changes: 4 additions & 4 deletions nonebot/adapters/satori/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ def image(
elif path:
data = {"src": Path(path).absolute().as_uri()}
elif raw and mime:
bd = raw["data"] if isinstance(raw, bytes) else raw.getvalue() # type: ignore
bd = raw if isinstance(raw, bytes) else raw.getvalue() # type: ignore
data = {"src": f"data:{mime};base64,{b64encode(bd).decode()}"}
else:
raise ValueError("image need at least one of url, path and raw")
Expand All @@ -115,7 +115,7 @@ def audio(
elif path:
data = {"src": Path(path).absolute().as_uri()}
elif raw and mime:
bd = raw["data"] if isinstance(raw, bytes) else raw.getvalue() # type: ignore
bd = raw if isinstance(raw, bytes) else raw.getvalue() # type: ignore
data = {"src": f"data:{mime};base64,{b64encode(bd).decode()}"}
else:
raise ValueError("audio need at least one of url, path and raw")
Expand All @@ -140,7 +140,7 @@ def video(
elif path:
data = {"src": Path(path).absolute().as_uri()}
elif raw and mime:
bd = raw["data"] if isinstance(raw, bytes) else raw.getvalue() # type: ignore
bd = raw if isinstance(raw, bytes) else raw.getvalue() # type: ignore
data = {"src": f"data:{mime};base64,{b64encode(bd).decode()}"}
else:
raise ValueError("video need at least one of url, path and raw")
Expand All @@ -165,7 +165,7 @@ def file(
elif path:
data = {"src": Path(path).absolute().as_uri()}
elif raw and mime:
bd = raw["data"] if isinstance(raw, bytes) else raw.getvalue() # type: ignore
bd = raw if isinstance(raw, bytes) else raw.getvalue() # type: ignore
data = {"src": f"data:{mime};base64,{b64encode(bd).decode()}"}
else:
raise ValueError("file need at least one of url, path and raw")
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[project]
name = "nonebot-adapter-satori"
version = "0.10.0"
version = "0.10.1"
description = "Satori Protocol Adapter for Nonebot2"
authors = [
{name = "RF-Tar-Railt",email = "[email protected]"},
Expand Down

0 comments on commit 5412714

Please sign in to comment.