Skip to content

Commit

Permalink
🐛 Fix: 消息段数据采用 str 存储 (#97)
Browse files Browse the repository at this point in the history
  • Loading branch information
yanyongyu authored Feb 23, 2024
1 parent 8151707 commit f7cf515
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions nonebot/adapters/onebot/v11/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
from nonebot.adapters.onebot.utils import truncate as trunc
from nonebot.adapters import MessageSegment as BaseMessageSegment

from .utils import log, escape, unescape
from .utils import escape, unescape


class MessageSegment(BaseMessageSegment["Message"]):
Expand Down Expand Up @@ -102,7 +102,6 @@ def face(cls, id_: int) -> Self:

@classmethod
def forward(cls, id_: str) -> Self:
log("WARNING", "Forward Message only can be received!")
return cls("forward", {"id": id_})

@classmethod
Expand All @@ -121,7 +120,7 @@ def image(
"type": type_,
"cache": b2s(cache),
"proxy": b2s(proxy),
"timeout": timeout,
"timeout": timeout if timeout is None else str(timeout),
},
)

Expand Down Expand Up @@ -149,7 +148,7 @@ def location(

@classmethod
def music(cls, type_: str, id_: int) -> Self:
return cls("music", {"type": type_, "id": id_})
return cls("music", {"type": type_, "id": str(id_)})

@classmethod
def music_custom(
Expand Down Expand Up @@ -204,7 +203,7 @@ def record(
"magic": b2s(magic),
"cache": b2s(cache),
"proxy": b2s(proxy),
"timeout": timeout,
"timeout": timeout if timeout is None else str(timeout),
},
)

Expand Down

0 comments on commit f7cf515

Please sign in to comment.