Skip to content

Commit

Permalink
🐛 修复类型错误
Browse files Browse the repository at this point in the history
消息组件和GetStatus接口
  • Loading branch information
XYCode-Kerman committed Jun 21, 2024
1 parent 39c3b75 commit ac36361
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
10 changes: 7 additions & 3 deletions mirai_onebot/api/interfaces/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

from pydantic import BaseModel

from mirai_onebot.api.interfaces.base import (BotSelf, Request, Response,
ResponseData)
from mirai_onebot.api.interfaces.base import (BotSelf, Request, RequestParams,
Response, ResponseData)


# ========== GetStatus ==========
Expand All @@ -17,9 +17,13 @@ class GetStatusResponseData(ResponseData):
bots: List[BotStatus]


class GetStatusRequestParams(RequestParams):
pass


class GetStatusRequest(Request):
action: str = 'get_status'
params: dict = {}
params: GetStatusRequestParams = GetStatusRequestParams()


class GetStatusResponse(Response):
Expand Down
7 changes: 5 additions & 2 deletions mirai_onebot/message/message_components.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def to_dict(self) -> Dict[str, Any]:
}

@staticmethod
def load_from_dict(data: dict) -> Union[Text, Mention, MentionAll, Image, Voice, Audio, Video, File, Location, Reply]:
def load_from_dict(data: dict) -> MessageComponentsType:
"""从字典加载为消息组件
Examples:
Expand Down Expand Up @@ -244,8 +244,11 @@ def __init__(self, message_id: str, user_id: Optional[str] = None) -> None:
self.data['user_id'] = self.user_id


MessageComponentsType = Union[Text, Mention, MentionAll, Image, Voice, Audio, Video, File, Location, Reply]

__all__ = [
'Text', 'Mention', 'MentionAll', 'Image',
'Voice', 'Audio', 'Video', 'File',
'Location', 'Reply'
'Location', 'Reply',
'MessageComponentsType'
]

0 comments on commit ac36361

Please sign in to comment.