BEISNWKZNAN / nonebot-plugin-essence-message

NoneBot-Plugin
MIT License
7 stars 2 forks source link

使用时报错:TypeError: 'NoneType' object is not subscriptable #6

Closed Pigeon0v0 closed 1 month ago

Pigeon0v0 commented 1 month ago

Alconna 版本为 0.51.4

Event & Matcher 08-28 15:27:09 [SUCCESS] nonebot | OneBot V11 [Removed] | [message.group.normal]: Message [Removed] from [Removed]@[群:[Removed]] 'essence random' 08-28 15:27:09 [INFO] nonebot | Event will be handled by AlconnaMatcher(type='', module=nonebot_plugin_essence_message, lineno=33) 08-28 15:27:09 [INFO] nonebot | AlconnaMatcher(type='', module=nonebot_plugin_essence_message, lineno=33) running complete 08-28 15:27:09 [INFO] nonebot | Event will be handled by AlconnaMatcher(type='', module=nonebot_plugin_essence_message, lineno=96) 08-28 15:27:09 [INFO] nonebot | AlconnaMatcher(type='', module=nonebot_plugin_essence_message, lineno=96) running complete
Stacktrace 08-28 15:27:09 [ERROR] nonebot | Running AlconnaMatcher(type='', module=nonebot_plugin_essence_message, lineno=96) failed. Traceback (most recent call last): File "", line 19, in File "D:\QQBotNew\Arona\.venv\lib\site-packages\nonebot\__init__.py", line 335, in run get_driver().run(*args, **kwargs) File "D:\QQBotNew\Arona\.venv\lib\site-packages\nonebot\drivers\fastapi.py", line 186, in run uvicorn.run( File "D:\QQBotNew\Arona\.venv\lib\site-packages\uvicorn\main.py", line 577, in run server.run() File "D:\QQBotNew\Arona\.venv\lib\site-packages\uvicorn\server.py", line 65, in run return asyncio.run(self.serve(sockets=sockets)) File "C:\Users\Server\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Users\Server\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete self.run_forever() File "C:\Users\Server\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever super().run_forever() File "C:\Users\Server\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever self._run_once() File "C:\Users\Server\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1909, in _run_once handle._run() File "C:\Users\Server\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, *self._args) File "D:\QQBotNew\Arona\.venv\lib\site-packages\nonebot\message.py", line 476, in check_and_run_matcher await _run_matcher( > File "D:\QQBotNew\Arona\.venv\lib\site-packages\nonebot\message.py", line 428, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "D:\QQBotNew\Arona\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 850, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "D:\QQBotNew\Arona\.venv\lib\site-packages\nonebot\internal\matcher\matcher.py", line 825, in simple_run await handler( File "D:\QQBotNew\Arona\.venv\lib\site-packages\nonebot\dependencies\__init__.py", line 94, in __call__ return await cast(Callable[..., Awaitable[R]], self.call)(**values) File "D:\QQBotNew\Arona\.venv\lib\site-packages\nonebot_plugin_essence_message\__init__.py", line 101, in random_cmd if msg[4] == "text": TypeError: 'NoneType' object is not subscriptable
BEISNWKZNAN commented 1 month ago

我猜测是数据库里没有任何一条精华消息导致的 这种情况下插件应该报错从而没有任何响应

Pigeon0v0 commented 1 month ago

我猜测是数据库里没有任何一条精华消息导致的 这种情况下插件应该报错从而没有任何响应

所以是需要有在插件安装以后的精华消息才可以触发是吗...

BEISNWKZNAN commented 1 month ago

可以使用fetchall获取以前的精华消息,不过在NapCat还有些问题 参见#4

Pigeon0v0 commented 1 month ago

我还恰好用的 NapCat... 等修.jpg

是否可以在列表为空时自动尝试 Fetch 一下?

BEISNWKZNAN commented 1 month ago

1 .使用V2.2.22以上的NapCat可以正常运行了

  1. 在不通知使用者的情况我认为还是不要,不过我加了个提示