Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: 商店无法使用物品ID购买物品 #1833

Open
ATTomatoo opened this issue Jan 12, 2025 · 11 comments
Open

Bug: 商店无法使用物品ID购买物品 #1833

ATTomatoo opened this issue Jan 12, 2025 · 11 comments
Labels
bug Something isn't working

Comments

@ATTomatoo
Copy link

ATTomatoo commented Jan 12, 2025

操作系统

Linux

Python 版本

3.10.10

zhenxun_bot 版本

v0.2.4-2c97eea

适配器

nonebot v11 2.1.3

协议端

NapCat 4.1.5

描述问题

在更新之后的商店中,shop中注册的道具无法使用 购买道具+物品ID购买, 只能购买道具+物品名称
sign_in 中注册的道具可以这样

复现步骤

购买神秘药水或重新在shop的register中重新注册个和神秘药水差不多的道具并使用

期望的结果

No response

截图或日志(请勿包含敏感信息如密码、令牌等)

1G{NUWEA G%87J26FPGLZ8B

01-12 22:02:07 [SUCCESS] nonebot | OneBot V11 1633813628 | [message.private.friend]: Message 1870821026 from 1126160939 '购买道具8'
01-12 22:02:07 [INFO] nonebot | Event will be handled by Matcher(type='message', module=zhenxun.plugins.mute.mute_message, lineno=32)
01-12 22:02:08 [INFO] nonebot | Event will be handled by Matcher(type='message', module=zhenxun.builtin_plugins.chat_history.chat_message, lineno=39)
01-12 22:02:08 [INFO] nonebot | Event will be handled by Matcher(type='message', module=zhenxun.plugins.parse_bilibili, lineno=53)
01-12 22:02:08 [INFO] nonebot | Matcher(type='message', module=zhenxun.plugins.mute.mute_message, lineno=32) running complete
01-12 22:02:08 [INFO] nonebot | Matcher(type='message', module=zhenxun.builtin_plugins.chat_history.chat_message, lineno=39) running complete
01-12 22:02:08 [INFO] nonebot | Matcher(type='message', module=zhenxun.plugins.parse_bilibili, lineno=53) running complete
01-12 22:02:08 [INFO] nonebot | Event will be handled by Matcher(type='message', module=zhenxun.plugins.black_word.black_watch, lineno=32)
01-12 22:02:08 [INFO] nonebot | Event will be handled by AlconnaMatcher(type='', module=zhenxun.builtin_plugins.shop, lineno=69)
01-12 22:02:08 [INFO] nonebot | Matcher(type='message', module=zhenxun.plugins.black_word.black_watch, lineno=32) running complete
01-12 22:02:08 [INFO] zhenxun | Adapter[OneBot V11] 平台[QQClient] 用户[1126160939] CMD[商店] 购买道具 Match(8, True), 数量: Query(num, 1)
01-12 22:02:08 [INFO] nonebot | AlconnaMatcher(type='', module=zhenxun.builtin_plugins.shop, lineno=69) running complete
01-12 22:02:08 [ERROR] nonebot | Running AlconnaMatcher(type='', module=zhenxun.builtin_plugins.shop, lineno=69) failed.
Traceback (most recent call last):
File "/opt/zhenxun_bot-dev/bot.py", line 32, in <module>
nonebot.run()
File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-aHa4dPee-py3.10/lib/python3.10/site-packages/nonebot/__init__.py", line 337, in run
get_driver().run(*args, **kwargs)
File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-aHa4dPee-py3.10/lib/python3.10/site-packages/nonebot/drivers/fastapi.py", line 187, in run
uvicorn.run(
File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-aHa4dPee-py3.10/lib/python3.10/site-packages/uvicorn/main.py", line 579, in run
server.run()
File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-aHa4dPee-py3.10/lib/python3.10/site-packages/uvicorn/server.py", line 66, in run
return asyncio.run(self.serve(sockets=sockets))
File "/root/.pyenv/versions/3.10.10/lib/python3.10/asyncio/runners.py", line 44, in run
return loop.run_until_complete(main)
File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-aHa4dPee-py3.10/lib/python3.10/site-packages/nonebot/utils.py", line 254, in run_coro_with_shield
return await coro
File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-aHa4dPee-py3.10/lib/python3.10/site-packages/nonebot/message.py", line 506, in check_and_run_matcher
await _run_matcher(
> File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-aHa4dPee-py3.10/lib/python3.10/site-packages/nonebot/message.py", line 458, in _run_matcher
await matcher.run(bot, event, state, stack, dependency_cache)
File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-aHa4dPee-py3.10/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 926, in run
await self.simple_run(bot, event, state, stack, dependency_cache)
File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-aHa4dPee-py3.10/lib/python3.10/site-packages/nonebot/internal/matcher/matcher.py", line 863, in simple_run
await handler(
File "/root/.cache/pypoetry/virtualenvs/zhenxun-bot-aHa4dPee-py3.10/lib/python3.10/site-packages/nonebot/dependencies/__init__.py", line 113, in __call__
return await cast(Callable[..., Awaitable[R]], self.call)(**values)
File "/opt/zhenxun_bot-dev/zhenxun/builtin_plugins/shop/__init__.py", line 170, in _
result = await ShopManage.buy_prop(session.user.id, name.result, num.result)
File "/opt/zhenxun_bot-dev/zhenxun/builtin_plugins/shop/_data_source.py", line 419, in buy_prop
goods = goods_list[int(name) - 1]
IndexError: list index out of range

01-12 22:03:39 [SUCCESS] nonebot | OneBot V11 1633813628 | [message.private.friend]: Message 1479797696 from 1126160939 '购买道具 神秘药水'
01-12 22:03:39 [INFO] nonebot | Event will be handled by Matcher(type='message', module=zhenxun.plugins.mute.mute_message, lineno=32)
01-12 22:03:39 [INFO] nonebot | Event will be handled by Matcher(type='message', module=zhenxun.builtin_plugins.chat_history.chat_message, lineno=39)
01-12 22:03:39 [INFO] nonebot | Event will be handled by Matcher(type='message', module=zhenxun.plugins.parse_bilibili, lineno=53)
01-12 22:03:39 [INFO] nonebot | Matcher(type='message', module=zhenxun.plugins.mute.mute_message, lineno=32) running complete
01-12 22:03:39 [INFO] nonebot | Matcher(type='message', module=zhenxun.builtin_plugins.chat_history.chat_message, lineno=39) running complete
01-12 22:03:39 [INFO] nonebot | Matcher(type='message', module=zhenxun.plugins.parse_bilibili, lineno=53) running complete
01-12 22:03:39 [INFO] nonebot | Event will be handled by Matcher(type='message', module=zhenxun.plugins.black_word.black_watch, lineno=32)
01-12 22:03:39 [INFO] nonebot | Event will be handled by AlconnaMatcher(type='', module=zhenxun.builtin_plugins.shop, lineno=69)
01-12 22:03:39 [INFO] nonebot | Matcher(type='message', module=zhenxun.plugins.black_word.black_watch, lineno=32) running complete
01-12 22:03:39 [INFO] zhenxun | Adapter[OneBot V11] 平台[QQClient] 用户[1126160939] CMD[商店] 购买道具 Match(神秘药水, True), 数量: Query(num, 1)
01-12 22:03:39 [INFO] zhenxun | 用户[1126160939] CMD[购买道具] 花费 999999.0 金币购买 神秘药水 ×1 成功!

@ATTomatoo ATTomatoo added the bug Something isn't working label Jan 12, 2025
@ATTomatoo ATTomatoo changed the title Bug: 商店 Bug: 商店无法使用物品ID购买物品 Jan 12, 2025
@HibiKier
Copy link
Owner

无法复现,看看你goods_info里的数据

@ATTomatoo
Copy link
Author

%PH0W5Q5K8A_NUV4_C8`8~A

@HibiKier
Copy link
Owner

bugfix/fix-shop-buy-a

@ATTomatoo
Copy link
Author

)MGR8$}SK_$JQDAN~V(P}B

@ATTomatoo
Copy link
Author

还是一样

@HibiKier
Copy link
Owner

把这表导出来发上来

@ATTomatoo
Copy link
Author

goods_info.csv
是这样嘛?

@HibiKier
Copy link
Owner

导出成sql文件

@ATTomatoo
Copy link
Author

zhenxun.zip
需要解压下

@HibiKier
Copy link
Owner

你导出一张表就行了啊,不要整个库

@ATTomatoo
Copy link
Author

goods_info.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants