MinatoAquaCrews / nonebot_plugin_what2eat

What2eat & what2drink plugin for nonebot2
MIT License
59 stars 9 forks source link

使用加菜报错 #17

Closed Tamamoimoto closed 2 years ago

Tamamoimoto commented 2 years ago

使用"加菜 西北风",机器人无回复后台报错。 07-30 18:59:59 [ERROR] nonebot | Running matcher <Matcher from nonebot_plugin_what2eat, type=message, priority=15, temp=False> failed. Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3.9/multiprocessing/spawn.py", line 116, in spawn_main exitcode = _main(fd, parent_sentinel) File "/usr/lib/python3.9/multiprocessing/spawn.py", line 129, in _main return self._bootstrap(parent_sentinel) File "/usr/lib/python3.9/multiprocessing/process.py", line 315, in _bootstrap self.run() File "/usr/lib/python3.9/multiprocessing/process.py", line 108, in run self._target(*self._args, **self._kwargs) File "/usr/local/lib/python3.9/dist-packages/uvicorn/subprocess.py", line 76, in subprocess_started target(sockets=sockets) File "/usr/local/lib/python3.9/dist-packages/uvicorn/server.py", line 60, in run return asyncio.run(self.serve(sockets=sockets)) File "/usr/lib/python3.9/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/usr/local/lib/python3.9/dist-packages/nonebot/message.py", line 146, in _check_matcher await _run_matcher(Matcher, bot, event, state, stack, dependency_cache)

File "/usr/local/lib/python3.9/dist-packages/nonebot/message.py", line 196, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "/usr/local/lib/python3.9/dist-packages/nonebot/internal/matcher.py", line 668, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "/usr/local/lib/python3.9/dist-packages/nonebot/internal/matcher.py", line 635, in simple_run await handler( File "/usr/local/lib/python3.9/dist-packages/nonebot/dependencies/init.py", line 92, in call return await self.call(**values) File "/usr/local/lib/python3.9/dist-packages/nonebot_pluginwhat2eat/init.py", line 69, in msg = eating_manager.add_basic_food(new_food) File "/usr/local/lib/python3.9/dist-packages/nonebot_plugin_what2eat/data_source.py", line 150, in add_basic_food status: FoodLoc = self._is_food_exists(new_food) TypeError: _is_food_exists() missing 1 required positional argument: 'gid'

KafCoppelia commented 2 years ago

感觉Optional的规则怎么偷偷改了呢,我之前用咋都不报错🤔

改一下data_source.py Line 100为:

def _is_food_exists(self, _food: str, gid: Optional[str] = None) -> FoodLoc:

或者升级到v0.3.3a2

pip/nb install nonebot_plugin_what2eat==0.3.3a2

目前v0.3.3a2还只是pre-release,不确保稳定,但是加入了新功能

KafCoppelia commented 2 years ago

v0.3.3已发布