HibiKier / nonebot_plugin_gamedraw

nonebot2 实现自动更新的 原神/明日方舟/赛马娘/坎公骑冠剑/公主连结/碧蓝航线/FGO/阴阳师 抽卡插件
MIT License
166 stars 21 forks source link

[Bug]: 碧蓝池子抽卡出现Bug? #23

Closed KafCoppelia closed 2 years ago

KafCoppelia commented 2 years ago

ubuntu 20.04 python 3.9.7-64bit nonebot2.0.0a16,go-cqhttp v1.0.0-beta8-fix2 输入“碧蓝轻型10抽”(重型等同情况),返回报错: `12-29 00:03:37 [ERROR] nonebot | Running matcher <Matcher from nonebot_plugin_gamedraw, type=message, priority=5, temp=False> failed. Traceback (most recent call last): File "/root/anaconda3/envs/nonebot_v2/bin/nb", line 8, in sys.exit(main()) File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/click/core.py", line 1128, in call return self.main(args, kwargs) File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/click/core.py", line 1053, in main rv = self.invoke(ctx) File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/click/core.py", line 1659, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx)) File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/click/core.py", line 1395, in invoke return ctx.invoke(self.callback, ctx.params) File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/click/core.py", line 754, in invoke return __callback(args, *kwargs) File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/nb_cli/commands/main.py", line 26, in run run_bot(file, app) File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/nb_cli/handlers/deploy.py", line 22, in run_bot nonebot.run(app=f"{module_name}:{app}") File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/nonebot/init.py", line 278, in run get_driver().run(host, port, args, **kwargs) File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/nonebot/drivers/fastapi.py", line 256, in run uvicorn.run( File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/uvicorn/main.py", line 447, in run server.run() File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/uvicorn/server.py", line 68, in run return asyncio.run(self.serve(sockets=sockets)) File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/asyncio/runners.py", line 44, in run return loop.run_until_complete(main) File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/nonebot/message.py", line 128, in _check_matcher await _run_matcher(Matcher, bot, event, state)

File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/nonebot/message.py", line 156, in _run_matcher await matcher.run(bot, event, state) File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/nonebot/matcher.py", line 597, in run await handler(self, bot, event, self.state) File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/nonebot/handler.py", line 64, in call await self.func( File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/nonebot_plugingamedraw/init.py", line 200, in await azur.send(await azur_draw(int(num), pool_name), at_sender=True) File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/nonebot_plugin_gamedraw/azur_handle.py", line 27, in azur_draw format_card_information(count, star_list, _get_azur_card, pool_name, guaranteed=False) File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/nonebot_plugin_gamedraw/util.py", line 274, in format_card_information obj, code = func(pool_name) File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/site-packages/nonebot_plugin_gamedraw/azur_handle.py", line 62, in _get_azur_card return random.choice(chars), 4 - star File "/root/anaconda3/envs/nonebot_v2/lib/python3.9/random.py", line 346, in choice return seq[self._randbelow(len(seq))] IndexError: list index out of range`

HibiKier commented 2 years ago

可以尝试把azur.json删除重新更新

KafCoppelia commented 2 years ago

删除后,重新启动bot,然后我查看了加载完全部卡池之后的json,发现只有碧蓝的json是空的(azur.json): {} 已在bot的.env.prod中改变了资源的存储路径: DRAW_PATH = "./data/draw_card/" 虽然README中写了要设置绝对路径,但其实我绝对/相对路径都尝试了发现效果一样,azur.json仍为“{}”

HibiKier commented 2 years ago

应该是碧蓝wiki改了,已修

KafCoppelia commented 2 years ago

好的,现在我是使用“nb plugin install‘’获取修正版么?

HibiKier commented 2 years ago

我不用cli,不太清楚,建议看文档

KafCoppelia commented 2 years ago

你好,我没发现源代码哪里有改变🤔将之前的json数据重新删除,并git clone 最新的代码加载至bot,重新下载数据,碧蓝依旧{} QAQ

HibiKier commented 2 years ago

?不会啊,我这里不管是pipy上的还是github上的都可以正常获取

KafCoppelia commented 2 years ago

已验证解决