Skip to content

Commit

Permalink
🐛 version 0.7.3
Browse files Browse the repository at this point in the history
fix get_history_message
  • Loading branch information
RF-Tar-Railt committed Nov 1, 2023
1 parent 728860e commit a5fff78
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
2 changes: 1 addition & 1 deletion nonebot/adapters/red/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,4 @@
from .event import GroupMessageEvent as GroupMessageEvent
from .event import PrivateMessageEvent as PrivateMessageEvent

__version__ = "0.7.2"
__version__ = "0.7.3"
10 changes: 5 additions & 5 deletions nonebot/adapters/red/event.py
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,7 @@ def get_session_id(self) -> str:
@override
def convert(cls, obj: Any):
assert isinstance(obj, MessageModel)
# fmt: off
params = {
"msgId": obj.msgId,
"msgRandom": obj.msgRandom,
Expand All @@ -342,16 +343,15 @@ def convert(cls, obj: Any):
"peerUid": obj.peerUid,
"peerUin": obj.peerUin,
"start": datetime.fromtimestamp(
obj.elements[0].grayTipElement.groupElement.shutUp.curTime
obj.elements[0].grayTipElement.groupElement.shutUp.curTime # type: ignore # noqa: E501
),
# type: ignore # noqa: E501
"duration": timedelta(
seconds=obj.elements[0].grayTipElement.groupElement.shutUp.duration
seconds=obj.elements[0].grayTipElement.groupElement.shutUp.duration # type: ignore # noqa: E501
),
# type: ignore # noqa: E501
"operator": obj.elements[0].grayTipElement.groupElement.shutUp.admin, # type: ignore # noqa: E501
"member": obj.elements[0].grayTipElement.groupElement.shutUp.member, # type: ignore # noqa: E501
"member": obj.elements[0].grayTipElement.groupElement.shutUp.member, # type: ignore # noqa: E501
}
# fmt: on
if params["duration"].total_seconds() < 1:
return MemberUnmuteEvent(**params)
return MemberMutedEvent(**params)
Expand Down
10 changes: 4 additions & 6 deletions nonebot/adapters/red/message.py
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ async def upload(self, bot: "Bot") -> UploadResponse:
files={f"file_{self.type}": (filename, data)},
)
)
return UploadResponse.parse_raw(resp.content)
return UploadResponse.parse_raw(resp.content) # type: ignore


class Message(BaseMessage[MessageSegment]):
Expand Down Expand Up @@ -204,11 +204,9 @@ def from_red_message(
elif text.atType == 1:
msg.append(MessageSegment.at_all())
elif text.atType == 2:
msg.append(
MessageSegment.at(
text.atNtUin or text.atNtUid, text.content[1:]
)
) # type: ignore # noqa: E501
# fmt: off
msg.append(MessageSegment.at(text.atNtUin or text.atNtUid, text.content[1:])) # type: ignore # noqa: E501
# fmt: on
if element.elementType == 2:
if TYPE_CHECKING:
assert element.picElement
Expand Down

0 comments on commit a5fff78

Please sign in to comment.