GraiaProject / Application

一个设计精巧, 协议实现完备的, 基于 mirai-api-http 的即时聊天软件自动化框架.
https://graia-document.vercel.app/
GNU Affero General Public License v3.0
438 stars 63 forks source link

当接收到 MemberLeaveEventKick 广播的时候会报错 #119

Closed Redlnn closed 3 years ago

Redlnn commented 3 years ago

描述你遇到的问题: 当接收到 MemberLeaveEventKick 广播的时候会报错

复现步骤: 该 BUG 会在进行以下操作后出现:

  1. 文档中的示例代码将 GroupMessage 替换为 MemberLeaveEventKick 接收到广播后发送任意消息

发生错误的代码

(省略了前面import和配置bcc的部分)

@bcc.receiver('MemberLeaveEventKick')
async def group_member_leave_kick_handler(group: Group, member: Member, app: GraiaMiraiApplication):
    await app.sendGroupMessage(group, MessageChain(__root__=[
            Plain('123')
        ]))

控制台日志输出截图:

graia报错(Windows):

Traceback (most recent call last):
  File "C:\Users\Red_lnn\AppData\Local\Programs\Python\Python39\lib\site-packages\graia\broadcast\__init__.py", line 177, in Executor
    parameter_compile_result[name] = await dii.lookup_param(
  File "C:\Users\Red_lnn\AppData\Local\Programs\Python\Python39\lib\site-packages\graia\broadcast\interfaces\dispatcher.py", line 310, in lookup_param
    raise RequirementCrashed(
graia.broadcast.exceptions.RequirementCrashed: ('the dispatching requirement crashed: ', 'member', <class 'graia.application.group.Member'>, None)

graia报错(Debian):

Traceback (most recent call last):
  File "/home/redlnn/.local/lib/python3.7/site-packages/graia/broadcast/__init__.py", line 178, in Executor
    name, annotation, default, target.param_paths[name]
  File "/home/redlnn/.local/lib/python3.7/site-packages/graia/broadcast/interfaces/dispatcher.py", line 314, in lookup_param
    self.default,
graia.broadcast.exceptions.RequirementCrashed: ('the dispatching requirement crashed: ', 'member', <class 'graia.application.group.Member'>, None)

mirai-console中相关的只有下列这一行(QQ号脱敏了):

2021-04-17 23:27:08 V/Bot.10000: Event: MemberLeaveEvent.Kick(member=10086, operator=10010)

运行环境:

额外信息:

相关库的版本:

python                  3.9 / 3.7
graia-broadcast         0.8.11
aiohttp                 3.7.4.post0
chardet                 3.0.4
croniter                0.3.37
idna                    2.10
regex                   2020.11.13
pydantic                1.7
yarl                    1.6.3
GreyElaina commented 3 years ago

graia.broadcast.exceptions.RequirementCrashed: ('the dispatching requirement crashed: ', 'member', <class 'graia.application.group.Member'>, None)

发生错误的地方很清楚了, 自己 Ctrl + 左键 进去 MemberLeaveEventKick 类里面看看吧....