Skip to content

Commit

Permalink
🐛 (api/interfaces/group.py) 修复Python 3.8不兼容的问题
Browse files Browse the repository at this point in the history
  • Loading branch information
XYCode-Kerman committed Jun 15, 2024
1 parent 4fbb397 commit 260643c
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
6 changes: 4 additions & 2 deletions mirai_onebot/api/interfaces/group.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from typing import List

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

Expand Down Expand Up @@ -28,7 +30,7 @@ class GetGroupListRequestParams(RequestParams):


class GetGroupListResponseData(ResponseData):
group_list: list[GetGroupInfoResponseData]
group_list: List[GetGroupInfoResponseData]


class GetGroupListRequest(Request):
Expand Down Expand Up @@ -69,7 +71,7 @@ class GetGroupMemberListRequestParams(RequestParams):


class GetGroupMemberListResponseData(ResponseData):
member_list: list[GetGroupMemberInfoResponseData]
member_list: List[GetGroupMemberInfoResponseData]


class GetGroupMemberListRequest(Request):
Expand Down
4 changes: 2 additions & 2 deletions mirai_onebot/event/bus.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def decorator(func: Callable) -> Callable:

return decorator

async def emit(self, event: Union[Type[EventBase], str], background: bool = True, *args, **kwargs) -> None:
async def emit(self, event: Union[Type[EventBase], str], *args, **kwargs) -> None:
"""触发事件
Args:
Expand All @@ -58,5 +58,5 @@ async def emit(self, event: Union[Type[EventBase], str], background: bool = True
if event in self._subscribers.keys():
tasks = [asyncio.create_task(subscriber(*args, **kwargs))
for subscriber in self._subscribers[event]]
if not background:
if kwargs.get('background', True) is False:
await asyncio.wait(tasks)

0 comments on commit 260643c

Please sign in to comment.