Closed SAGIRI-kawaii closed 2 years ago
请求 type(interface.event) 的内容
请求 type(interface.event) 的内容
在 GroupRecallEvent
事件下加入 print(type(interface.event))
后,当收到 MemberJoinEvent
时发生报错(graia.ariadne.event.mirai line 286
)
打印信息如下:
<class 'graia.ariadne.event.mirai.GroupRecallEvent'>
<class 'graia.ariadne.event.mirai.GroupRecallEvent'>
<class 'graia.ariadne.event.mirai.MemberJoinEvent'>
报错信息如下:
2022-01-21 17:00:03.875 | ERROR | graia.ariadne.util:loguru_excepthook:97 - Exception:
Traceback (most recent call last):
File "W:/Python workspace/RE-SAGIRIBOT\main.py", line 70, in <module>
core.launch()
│ └ <function AppCore.launch at 0x000002186CB934C0>
└ <sagiri_bot.core.app_core.AppCore object at 0x00000218533785E0>
File "W:\Python workspace\RE-SAGIRIBOT\sagiri_bot\core\app_core.py", line 127, in launch
self.__app.launch_blocking()
└ <sagiri_bot.core.app_core.AppCore object at 0x00000218533785E0>
File "S:\Anaconda3\envs\ariadne\lib\site-packages\graia\ariadne\app.py", line 1463, in launch_blocking
self.loop.run_until_complete(self.lifecycle())
│ │ │ │ └ <function Ariadne.lifecycle at 0x000002186C237CA0>
│ │ │ └ <graia.ariadne.app.Ariadne object at 0x000002186CBA3F40>
│ │ └ <function BaseEventLoop.run_until_complete at 0x000002186B307AF0>
│ └ <ProactorEventLoop running=True closed=False debug=False>
└ <graia.ariadne.app.Ariadne object at 0x000002186CBA3F40>
File "S:\Anaconda3\envs\ariadne\lib\asyncio\base_events.py", line 603, in run_until_complete
self.run_forever()
│ └ <function ProactorEventLoop.run_forever at 0x000002186B6C4160>
└ <ProactorEventLoop running=True closed=False debug=False>
File "S:\Anaconda3\envs\ariadne\lib\asyncio\windows_events.py", line 316, in run_forever
super().run_forever()
File "S:\Anaconda3\envs\ariadne\lib\asyncio\base_events.py", line 570, in run_forever
self._run_once()
│ └ <function BaseEventLoop._run_once at 0x000002186B30B5E0>
└ <ProactorEventLoop running=True closed=False debug=False>
File "S:\Anaconda3\envs\ariadne\lib\asyncio\base_events.py", line 1859, in _run_once
handle._run()
│ └ <function Handle._run at 0x000002186B2AD3A0>
└ <Handle <TaskStepMethWrapper object at 0x0000021818976F10>()>
File "S:\Anaconda3\envs\ariadne\lib\asyncio\events.py", line 81, in _run
self._context.run(self._callback, *self._args)
│ │ │ │ │ └ <member '_args' of 'Handle' objects>
│ │ │ │ └ <Handle <TaskStepMethWrapper object at 0x0000021818976F10>()>
│ │ │ └ <member '_callback' of 'Handle' objects>
│ │ └ <Handle <TaskStepMethWrapper object at 0x0000021818976F10>()>
│ └ <member '_context' of 'Handle' objects>
└ <Handle <TaskStepMethWrapper object at 0x0000021818976F10>()>
> File "S:\Anaconda3\envs\ariadne\lib\site-packages\graia\broadcast\__init__.py", line 147, in Executor
parameter_compile_result[name] = await dii.lookup_param(name, annotation, default, optimized_log)
│ │ │ │ │ │ │ └ [<class 'graia.ariadne.event.mirai.GroupRecallEvent.Dispatcher'>]
│ │ │ │ │ │ └ None
│ │ │ │ │ └ <class 'graia.ariadne.model.Group'>
│ │ │ │ └ 'group'
│ │ │ └ <function DispatcherInterface.lookup_param at 0x000002186B7D6310>
│ │ └ <graia.broadcast.interfaces.dispatcher.DispatcherInterface object at 0x000002186CBA3DC0>
│ └ 'group'
└ {'app': <graia.ariadne.app.Ariadne object at 0x000002186CBA3F40>}
File "S:\Anaconda3\envs\ariadne\lib\site-packages\graia\broadcast\interfaces\dispatcher.py", line 88, in lookup_param
result = await getattr(dispatcher, "catch", dispatcher)(self) # type: ignore
│ │ └ <graia.broadcast.interfaces.dispatcher.DispatcherInterface object at 0x000002186CBA3DC0>
│ └ <class 'graia.ariadne.event.mirai.GroupRecallEvent.Dispatcher'>
└ <class 'graia.ariadne.event.mirai.GroupRecallEvent.Dispatcher'>
File "S:\Anaconda3\envs\ariadne\lib\site-packages\graia\ariadne\event\mirai.py", line 288, in catch
return interface.event.group
│ └ <property object at 0x000002186B7D0590>
└ <graia.broadcast.interfaces.dispatcher.DispatcherInterface object at 0x000002186CBA3DC0>
AttributeError: 'MemberJoinEvent' object has no attribute 'group'
值得注意的是在错误追溯中本应追溯到 MemberJoinEvent
的 catch
函数,结果却追溯到了 GroupRecallEvent
的 catch
函数
问题 多个事件报错
AttributeError: 'XXXEvent' object has no attribute '[group|member|...]'
如何复现 尝试以下代码:
发生如日志中错误
预期行为 你希望如何更改/原本应该是怎样的.
使用环境:
日志/截图 将任何有关的日志/截图放到这里(控制台输出/MAH 输出/...)