Skip to content

Commit

Permalink
🐛 修复Bus.emit方法测试错误的问题
Browse files Browse the repository at this point in the history
把background参数放kwargs里了,通过单开一个参数解决。
  • Loading branch information
XYCode-Kerman committed Jun 21, 2024
1 parent b0daf13 commit 0b4b975
Showing 1 changed file with 2 additions and 2 deletions.
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], *args, **kwargs) -> None:
async def emit(self, event: Union[Type[EventBase], str], background=True, *args, **kwargs) -> None:
"""触发事件
Args:
Expand All @@ -58,5 +58,5 @@ async def emit(self, event: Union[Type[EventBase], str], *args, **kwargs) -> Non
if event in self._subscribers.keys():
tasks = [asyncio.create_task(subscriber(*args, **kwargs))
for subscriber in self._subscribers[event]]
if kwargs.get('background', True) is False:
if not background:
await asyncio.wait(tasks)

0 comments on commit 0b4b975

Please sign in to comment.