kitUIN / nonebot_tools

nonebot2 插件工具箱
MIT License
11 stars 5 forks source link

没有权限怎么解决 #5

Closed yuanzhidao closed 3 years ago

yuanzhidao commented 3 years ago

File "/usr/local/lib/python3.9/site-packages/nonebot/message.py", line 154, in _run_matcher await matcher.run(bot, event, state) File "/usr/local/lib/python3.9/site-packages/nonebot/matcher.py", line 584, in run await handler(self, bot, event, self.state) File "/usr/local/lib/python3.9/site-packages/nonebot/handler.py", line 81, in call await self.func( File "/usr/local/lib/python3.9/site-packages/nonebot-plugin-ncm/init.py", line 54, in message_receive logger.info(event.dict()) File "pydantic/main.py", line 510, in pydantic.main.BaseModel.dict return dict( File "pydantic/main.py", line 875, in _iter v = self._get_value( File "pydantic/main.py", line 816, in pydantic.main.BaseModel._get_value return v.class(*seq_args) if is_namedtuple(v.class) else v.class(seq_args) File "/usr/local/lib/python3.9/site-packages/nonebot/adapters/_base.py", line 330, in init self.extend(self._construct(message)) File "/usr/local/lib/python3.9/site-packages/nonebot/adapters/_base.py", line 400, in extend for segment in obj: File "/usr/local/lib/python3.9/site-packages/nonebot/adapters/cqhttp/message.py", line 265, in _construct yield MessageSegment(seg["type"], seg.get("data") or {}) File "/usr/local/lib/python3.9/site-packages/nonebot/adapters/_base.py", line 278, in getitem return self.data[key] KeyError: 'type'

yuanzhidao commented 3 years ago

image

yuanzhidao commented 3 years ago

且其他插件都无法使用了

kitUIN commented 3 years ago

在群内不是管理员或群主 在.env配置文件中更改 image member为群友,admin为管理员,owner为群主 或者更改superusers,添加你的QQ号作为超级管理员 image 另外请使用1.0.1版本,修复了一个数据类型bug

yuanzhidao commented 3 years ago

上一个版本好像添加superusers没有效果 新版本好了

yuanzhidao commented 3 years ago

py", line 126, in _check_matcher await _run_matcher(Matcher, bot, event, state)

File "/usr/local/lib/python3.9/site-packages/nonebot/message.py", line 154, in _run_matcher await matcher.run(bot, event, state) File "/usr/local/lib/python3.9/site-packages/nonebot/matcher.py", line 584, in run await handler(self, bot, event, self.state) File "/usr/local/lib/python3.9/site-packages/nonebot/handler.py", line 81, in call await self.func( File "/usr/local/lib/python3.9/site-packages/nonebot-plugin-ncm/init.py", line 55, in message_receive _reply = event.dict()["reply"] File "pydantic/main.py", line 510, in pydantic.main.BaseModel.dict return dict( File "pydantic/main.py", line 875, in _iter v = self._get_value( File "pydantic/main.py", line 816, in pydantic.main.BaseModel._get_value return v.class(*seq_args) if is_namedtuple(v.class) else v.class(seq_args) File "/usr/local/lib/python3.9/site-packages/nonebot/adapters/_base.py", line 330, in init self.extend(self._construct(message)) File "/usr/local/lib/python3.9/site-packages/nonebot/adapters/_base.py", line 400, in extend for segment in obj: File "/usr/local/lib/python3.9/site-packages/nonebot/adapters/cqhttp/message.py", line 265, in _construct yield MessageSegment(seg["type"], seg.get("data") or {}) File "/usr/local/lib/python3.9/site-packages/nonebot/adapters/_base.py", line 278, in getitem return self.data[key] KeyError: 'type'

新版不提醒没有权限 但是后台依旧报错

kitUIN commented 3 years ago

具体是干什么的时候报错的。

yuanzhidao commented 3 years ago

发消息 不管啥消息 除了/ncm,/ncm t也报错

kitUIN commented 3 years ago

难以复现该bug,但可以尝试下新的版本 pip install nonebot-plugin-ncm --upgrade

yuanzhidao commented 3 years ago

1.0.2版本 输入/ncm t同样报错

yuanzhidao commented 3 years ago

File "/usr/local/lib/python3.9/site-packages/nonebot/message.py", line 154, in _run_matcher await matcher.run(bot, event, state) File "/usr/local/lib/python3.9/site-packages/nonebot/matcher.py", line 584, in run await handler(self, bot, event, self.state) File "/usr/local/lib/python3.9/site-packages/nonebot/handler.py", line 81, in call await self.func( File "/usr/local/lib/python3.9/site-packages/nonebot-plugin-ncm/init.py", line 102, in set_receive if event.dict()['sender']['role'] in ncm_config.ncm_admin or str(event.dict()['sender']['user_id']) in ncm_config.superusers: File "pydantic/main.py", line 510, in pydantic.main.BaseModel.dict return dict( File "pydantic/main.py", line 875, in _iter v = self._get_value( File "pydantic/main.py", line 816, in pydantic.main.BaseModel._get_value return v.class(*seq_args) if is_namedtuple(v.class) else v.class(seq_args) File "/usr/local/lib/python3.9/site-packages/nonebot/adapters/_base.py", line 330, in init self.extend(self._construct(message)) File "/usr/local/lib/python3.9/site-packages/nonebot/adapters/_base.py", line 400, in extend for segment in obj: File "/usr/local/lib/python3.9/site-packages/nonebot/adapters/cqhttp/message.py", line 265, in _construct yield MessageSegment(seg["type"], seg.get("data") or {}) File "/usr/local/lib/python3.9/site-packages/nonebot/adapters/_base.py", line 278, in getitem return self.data[key] KeyError: 'type'

kitUIN commented 3 years ago

不使用我的插件依旧有该bug么?

yuanzhidao commented 3 years ago

关掉插件后正常

kitUIN commented 3 years ago

尝试将nonebot-adapter-cqhttp回滚到2.0.0a13版本 pip install nonebot-adapter-cqhttp==2.0.0a13

yuanzhidao commented 3 years ago

回滚后出现新的错误 08-12 10:17:31 [ERROR] nonebot | Running matcher <Matcher from. Traceback (most recent call last): File "/usr/local/bin/nb", line 8, in sys.exit(main()) File "/usr/local/lib/python3.9/site-packages/click/core.py",_ return self.main(args, kwargs) File "/usr/local/lib/python3.9/site-packages/click/core.py",n rv = self.invoke(ctx) File "/usr/local/lib/python3.9/site-packages/click/core.py",e return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/usr/local/lib/python3.9/site-packages/click/core.py",e return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.9/site-packages/click/core.py",e return callback(args, *kwargs) File "/usr/local/lib/python3.9/site-packages/nb_cli/initn run_bot(file, app) File "/usr/local/lib/python3.9/site-packages/nb_cli/handlerst nonebot.run(app=f"{module_name}:{app}") File "/usr/local/lib/python3.9/site-packages/nonebot/__init_n get_driver().run(host, port, args, **kwargs) File "/usr/local/lib/python3.9/site-packages/nonebot/driversn uvicorn.run(app or self.server_app, File "/usr/local/lib/python3.9/site-packages/uvicorn/main.pyn server.run() File "/usr/local/lib/python3.9/site-packages/uvicorn/server.n loop.run_until_complete(self.serve(sockets=sockets)) File "/usr/local/lib/python3.9/site-packages/nonebot/messager await _run_matcher(Matcher, bot, event, state)

File "/usr/local/lib/python3.9/site-packages/nonebot/messager await matcher.run(bot, event, state) File "/usr/local/lib/python3.9/site-packages/nonebot/matchern await handler(self, bot, event, state) File "/usr/local/lib/python3.9/site-packages/nonebot/handler await self.func( File "/usr/local/lib/python3.9/site-packages/nonebot-plugin-e info = setting.search(Q["group_id"] == event.dict()["group) KeyError: 'group_id'

kitUIN commented 3 years ago

确定是在群聊界面吗? db文件夹删掉重开插件

yuanzhidao commented 3 years ago

啊 我私聊

yuanzhidao commented 3 years ago

群聊中运行正常了 但是08-12 10:24:37 [ERROR] nonebot-plugin-ncm | 数据库中未有该音 地址数据 怎么解决

kitUIN commented 3 years ago

新版本已修复 pip install nonebot-plugin-ncm --upgrade

yuanzhidao commented 3 years ago

问题已解决 nonebot-adapter-cqhttp升级后能否使用

kitUIN commented 3 years ago

nonebot-adapter-cqhttp==2.0.0a14版本有bug,无法使用

yuanzhidao commented 3 years ago

好的谢谢