mirror of
https://github.com/nonebot/nonebot2.git
synced 2024-11-30 17:15:08 +08:00
🐛 fix coroutine check error
This commit is contained in:
parent
a85ee6555f
commit
180aaadda9
@ -5,11 +5,10 @@
|
|||||||
该模块实现事件处理函数的封装,以实现动态参数等功能。
|
该模块实现事件处理函数的封装,以实现动态参数等功能。
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import asyncio
|
|
||||||
from contextlib import AsyncExitStack
|
from contextlib import AsyncExitStack
|
||||||
from typing import Any, Dict, List, Type, Callable, Optional
|
from typing import Any, Dict, List, Type, Callable, Optional
|
||||||
|
|
||||||
from nonebot.utils import get_name, run_sync
|
from nonebot.utils import get_name, run_sync, is_coroutine_callable
|
||||||
from nonebot.dependencies import (
|
from nonebot.dependencies import (
|
||||||
Param,
|
Param,
|
||||||
Dependent,
|
Dependent,
|
||||||
@ -94,7 +93,7 @@ class Handler:
|
|||||||
**params,
|
**params,
|
||||||
)
|
)
|
||||||
|
|
||||||
if asyncio.iscoroutinefunction(self.call):
|
if is_coroutine_callable(self.call):
|
||||||
return await self.call(**values)
|
return await self.call(**values)
|
||||||
else:
|
else:
|
||||||
return await run_sync(self.call)(**values)
|
return await run_sync(self.call)(**values)
|
||||||
|
Loading…
Reference in New Issue
Block a user