✨ 资源下载分离 (#1814)

* 🚀 资源文件单独下载,分离被动任务初始化

* 🔥 移除resources文件夹

* 🚀 优化版本更新逻辑,增加资源下载异常处理

* 🚀 增加资源下载失败异常处理及提示信息

* 🚀 增加资源下载选项及异常处理优化

* 🚀 移除空ID检查及资源更新条件处理

* ✨ 简易配置中未加载的配置将被移除

* 🐛 测试更新

* ✨ 修复更新完成消息格式

---------

Co-authored-by: Flern <cb56ec362bbbfb5272eb941281299d8d-qq_connect@git.osc>
This commit is contained in:
HibiKier
2025-01-06 11:32:56 +08:00
committed by GitHub
co-authored by Flern
parent 91dce56bf8
commit ec70144d7e
308 changed files with 397 additions and 38881 deletions
+11 -3
View File
@@ -16,6 +16,7 @@ from zhenxun.models.sign_user import SignUser
from zhenxun.models.user_console import UserConsole
from zhenxun.services.log import logger
from zhenxun.utils.decorator.shop import shop_register
from zhenxun.utils.manager.resource_manager import ResourceManager
from zhenxun.utils.platform import PlatformUtils
driver: Driver = nonebot.get_driver()
@@ -36,9 +37,15 @@ async def _(bot: Bot):
@driver.on_bot_disconnect
async def _(bot: Bot):
logger.debug(f"Bot: {bot.self_id} 断开连接...")
await BotConnectLog.create(
bot_id=bot.self_id, platform=bot.adapter, connect_time=datetime.now(), type=0
)
try:
await BotConnectLog.create(
bot_id=bot.self_id,
platform=bot.adapter,
connect_time=datetime.now(),
type=0,
)
except Exception as e:
logger.warning(f"记录bot: {bot.self_id} 断开连接失败", e=e)
SIGN_SQL = """
@@ -65,6 +72,7 @@ from public.bag_users t1
@driver.on_startup
async def _():
await ResourceManager.init_resources()
"""签到与用户的数据迁移"""
if goods_list := await GoodsInfo.filter(uuid__isnull=True).all():
for goods in goods_list: