From add52df91558572fc3d919924a2f6bfab6dc7f2d Mon Sep 17 00:00:00 2001 From: Chenwe_i_lin <1846913566@qq.com> Date: Tue, 3 Mar 2020 20:16:29 +0800 Subject: [PATCH] hotfix: run_body.__call__.__annotations__ --- mirai/session.py | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/mirai/session.py b/mirai/session.py index ca994a1..6c72549 100644 --- a/mirai/session.py +++ b/mirai/session.py @@ -270,11 +270,18 @@ async def main_entrance(self, run_body, event_context, queue): callable_target = run_body['func'] for depend in run_body['dependencies']: await self.main_entrance( - {"func": depend.func.__call__, "middlewares": depend.middlewares}, + { + "func": depend.func if not inspect.isclass(depend.func) else\ + depend.func.__call__ if hasattr(depend.func, "__call__") else\ + raiser(TypeError("must be callable.")), + "middlewares": depend.middlewares + }, event_context, queue ) else: - callable_target = run_body.__call__ + callable_target = run_body if not inspect.isclass(run_body) else\ + run_body.__call__ if hasattr(run_body, "__call__") else\ + raiser(TypeError("must be callable.")) translated_mapping = { **(await self.argument_compiler(