HibiKier / zhenxun_bot

基于 Nonebot2 开发,非常可爱的绪山真寻bot
GNU Affero General Public License v3.0
3.36k stars 605 forks source link

升级后使用背包没有的道具提示 list index out of range #1623

Closed xiaobaozi233 closed 1 month ago

xiaobaozi233 commented 1 month ago

系统版本:win11

真寻版本:v0.2.2dev

错误截图

09-11 16:54:25 [SUCCESS] nonebot | OneBot V11 qqbot | [message.group.normal]: Message 899** from 523**@[群:61 **] '使用道具0' 09-11 16:54:25 [INFO] nonebot | Event will be handled by Matcher(type='message', module=zhenxun.builtin_plugins.chat_histo ry.chat_message, lineno=39) 09-11 16:54:25 [INFO] nonebot | Matcher(type='message', module=zhenxun.builtin_plugins.chat_history.chat_message, lineno=3 9) running complete 09-11 16:54:25 [INFO] nonebot | Event will be handled by AlconnaMatcher(type='', module=zhenxun.builtin_plugins.shop, line no=50) 09-11 16:54:25 [INFO] nonebot | AlconnaMatcher(type='', module=zhenxun.builtin_plugins.shop, lineno=50) running complete

09-11 16:54:25 [ERROR] nonebot | Running AlconnaMatcher(type='', module=zhenxun.builtin_plugins.shop, lineno=50) failed. Traceback (most recent call last): File "D:\qqbot\zhenxun_2\bot.py", line 28, in nonebot.run() File "C:\Users\pcuses\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-mhF7-reI-py3.10\lib\site-packages\nonebot__init __.py", line 335, in run get_driver().run(*args, *kwargs) File "C:\Users\pcuses\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-mhF7-reI-py3.10\lib\site-packages\nonebot\driver s\fastapi.py", line 186, in run uvicorn.run( File "C:\Users\pcuses\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-mhF7-reI-py3.10\lib\site-packages\uvicorn\main.p y", line 577, in run server.run() File "C:\Users\pcuses\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-mhF7-reI-py3.10\lib\site-packages\uvicorn\server .py", line 65, in run return asyncio.run(self.serve(sockets=sockets)) File "C:\Users\pcuses\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run return loop.run_until_complete(main) File "C:\Users\pcuses\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 636, in run_until_complete self.run_forever() File "C:\Users\pcuses\AppData\Local\Programs\Python\Python310\lib\asyncio\windows_events.py", line 321, in run_forever super().run_forever() File "C:\Users\pcuses\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 603, in run_forever self._run_once() File "C:\Users\pcuses\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 1906, in _run_once handle._run() File "C:\Users\pcuses\AppData\Local\Programs\Python\Python310\lib\asyncio\events.py", line 80, in _run self._context.run(self._callback, self._args) File "C:\Users\pcuses\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-mhF7-reI-py3.10\lib\site-packages\nonebot\messag e.py", line 476, in check_and_run_matcher await _run_matcher(

File "C:\Users\pcuses\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-mhF7-reI-py3.10\lib\site-packages\nonebot\messag e.py", line 428, in _run_matcher await matcher.run(bot, event, state, stack, dependency_cache) File "C:\Users\pcuses\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-mhF7-reI-py3.10\lib\site-packages\nonebot\intern al\matcher\matcher.py", line 850, in run await self.simple_run(bot, event, state, stack, dependency_cache) File "C:\Users\pcuses\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-mhF7-reI-py3.10\lib\site-packages\nonebot\intern al\matcher\matcher.py", line 825, in simple_run await handler( File "C:\Users\pcuses\AppData\Local\pypoetry\Cache\virtualenvs\zhenxun-bot-mhF7-reI-py3.10\lib\site-packages\nonebot\depend encies__init.py", line 94, in call return await cast(Callable[..., Awaitable[R]], self.call)(**values) File "D:\qqbot\zhenxun_2\zhenxun\builtin_plugins\shop\init_.py", line 166, in result = await ShopManage.use(bot, event, session, message, name, num, "") File "D:\qqbot\zhenxun_2\zhenxun\builtin_plugins\shop_data_source.py", line 298, in use uuid = list(user.props.keys())[int(goods_name)] IndexError: list index out of range

日志截图

[img]

错误说明

我是从v0.1.6.7,更新最新版本:v0.2.2dev的. 签到功能目前正常了,但是使用背包里没有的道具会报错。 请教一下,下面这个数量是0是正常的吗?数据库里看还有2。 791cbbd7b51c5f6fd2cfc9163027e6c2

image

HibiKier commented 1 month ago

把你的user_console和sign_user表删了重启试试

xiaobaozi233 commented 1 month ago

正常了