xxtg666 / nonebot-plugin-discord-message-bridge

✨ Discord - QQ 消息转发插件 ✨
GNU General Public License v3.0
6 stars 1 forks source link

Bug: data 不存在时出现报错 #5

Closed This-is-XiaoDeng closed 3 months ago

This-is-XiaoDeng commented 3 months ago
7月 21 00:55:11 xd-debian poetry[17324]:   File "<frozen importlib._bootstrap_external>", line 940, in exec_module
7月 21 00:55:11 xd-debian poetry[17324]:   File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
7月 21 00:55:11 xd-debian poetry[17324]:   File "/home/xiaodeng/.cache/pypoetry/virtualenvs/forward-chOrmiwl-py3.11/lib/python3.11/site-packages/nonebot_plugin_discord_message_bridge/__init__.py", line 32, in <module>
7月 21 00:55:11 xd-debian poetry[17324]:     json.dump({}, open(qq_bind_file, "w"))
7月 21 00:55:11 xd-debian poetry[17324]: FileNotFoundError: [Errno 2] No such file or directory: 'data/discord_message_bridge_qq_bind.json'

建议:再读取前检测并创建(如果不存在)

xxtg666 commented 3 months ago

(? 这一行代码就是尝试创建 难不成我这都写错了

哦data目录不存在 我一直以为这个目录是会自动创建的

xxtg666 commented 3 months ago

fix https://github.com/xxtg666/nonebot-plugin-discord-message-bridge/commit/9f68d1378a85b42530842dc13d4094cb73b18ed1