Yuri-YuzuChaN / maimaiDX

基于HoshinoBot V2的舞萌DX查询插件,移植自mai-bot开源项目
MIT License
200 stars 32 forks source link

maimai_arcade相关疑问,问题出现在添加机厅别名时 #117

Closed luoyeye001 closed 1 year ago

luoyeye001 commented 1 year ago

主要报错:ERROR: 'Arcade' object has no attribute 'modeldump' 解决尝试:检查了所需的依赖且确定无误依旧报错 详细报错: [2023-09-27 08:21:00,479 maimaiDX排卡] ERROR: <class 'AttributeError'> occured when handling message 275063169. [2023-09-27 08:21:00,479 maimaiDX排卡] ERROR: 'Arcade' object has no attribute 'model_dump' Traceback (most recent call last): File "C:\Users\Administrator\HoshinoBot\hoshino\msghandler.py", line 28, in handle_message await sf.func(bot, event) File "C:\Users\Administrator\HoshinoBot\hoshino\modules\maimai\maimaiarcade.py", line 89, in msg = await modify(arcadeName=args[0], aliasName=args[1]) File "C:\Users\Administrator\HoshinoBot\hoshino\modules\maimai\libraries\maimaidx_arcade.py", line 231, in modify await arcade.total.save_arcade() File "C:\Users\Administrator\HoshinoBot\hoshino\modules\maimai\libraries\maimaidx_arcade.py", line 31, in save_arcade return await writefile(arcadesjson, [.modeldump() for in self]) File "C:\Users\Administrator\HoshinoBot\hoshino\modules\maimai\libraries\maimaidx_arcade.py", line 31, in return await writefile(arcadesjson, [.modeldump() for in self]) AttributeError: 'Arcade' object has no attribute 'model_dump'

luoyeye001 commented 1 year ago

已推Pr进行修复,将 Arcade 对象列表写入 JSON 文件,直接使用 Python 的内置 json 模块来序列化 Arcade 对象列表,而不需要 model_dump 方法,避免error