✨ 资源下载分离 (#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
@@ -16,7 +16,7 @@ router = APIRouter(prefix="/menu")
dependencies=[authentication()],
response_model=Result[list[MenuData]],
response_class=JSONResponse,
deprecated="获取菜单列表", # type: ignore
description="获取菜单列表",
)
async def _() -> Result[list[MenuData]]:
try:
@@ -23,7 +23,7 @@ driver = nonebot.get_driver()
dependencies=[authentication()],
response_model=Result[list[BotInfo]],
response_class=JSONResponse,
deprecated="获取bot列表", # type: ignore
description="获取bot列表", # type: ignore
)
async def _() -> Result[list[BotInfo]]:
try:
@@ -74,7 +74,7 @@ async def _(bot_id: str | None = None) -> Result[AllChatAndCallCount]:
dependencies=[authentication()],
response_model=Result[ChatCallMonthCount],
response_class=JSONResponse,
deprecated="获取聊天/调用记录的一个月数量", # type: ignore
description="获取聊天/调用记录的一个月数量", # type: ignore
)
async def _(bot_id: str | None = None) -> Result[ChatCallMonthCount]:
try:
@@ -91,7 +91,7 @@ async def _(bot_id: str | None = None) -> Result[ChatCallMonthCount]:
dependencies=[authentication()],
response_model=Result[BaseResultModel],
response_class=JSONResponse,
deprecated="获取Bot连接记录", # type: ignore
description="获取Bot连接记录", # type: ignore
)
async def _(query: QueryModel) -> Result[BaseResultModel]:
try:
@@ -106,7 +106,7 @@ async def _(query: QueryModel) -> Result[BaseResultModel]:
dependencies=[authentication()],
response_model=Result[Config],
response_class=JSONResponse,
deprecated="获取nb配置", # type: ignore
description="获取nb配置", # type: ignore
)
async def _() -> Result[Config]:
return Result.ok(driver.config)
@@ -85,9 +85,6 @@ async def _(group: UpdateGroup) -> Result[str]:
description="获取好友列表",
)
async def _(bot_id: str) -> Result[list[Friend]]:
"""
获取群信息
"""
try:
bot = nonebot.get_bot(bot_id)
friend_list, _ = await PlatformUtils.get_friend_list(bot)
@@ -95,7 +92,7 @@ async def _(bot_id: str) -> Result[list[Friend]]:
for f in friend_list:
ava_url = AVA_URL.format(f.user_id)
result_list.append(
Friend(user_id=f.user_id, nickname=f.nickname, ava_url=ava_url)
Friend(user_id=f.user_id, nickname=f.user_name or "", ava_url=ava_url)
)
return Result.ok(
result_list,
@@ -24,7 +24,7 @@ router = APIRouter(prefix="/plugin")
dependencies=[authentication()],
response_model=Result[list[PluginInfo]],
response_class=JSONResponse,
deprecated="获取插件列表", # type: ignore
description="获取插件列表", # type: ignore
)
async def _(
plugin_type: list[PluginType] = Query(None), menu_type: str | None = None
@@ -43,7 +43,7 @@ async def _(
dependencies=[authentication()],
response_model=Result[int],
response_class=JSONResponse,
deprecated="获取插件数量", # type: ignore
description="获取插件数量", # type: ignore
)
async def _() -> Result[int]:
try:
@@ -16,7 +16,7 @@ router = APIRouter(prefix="/store")
dependencies=[authentication()],
response_model=Result[dict],
response_class=JSONResponse,
deprecated="获取插件商店插件信息", # type: ignore
description="获取插件商店插件信息", # type: ignore
)
async def _() -> Result[dict]:
try:
@@ -41,7 +41,7 @@ async def _() -> Result[dict]:
dependencies=[authentication()],
response_model=Result,
response_class=JSONResponse,
deprecated="安装插件", # type: ignore
description="安装插件", # type: ignore
)
async def _(param: PluginIr) -> Result:
try:
@@ -59,7 +59,7 @@ async def _(param: PluginIr) -> Result:
dependencies=[authentication()],
response_model=Result,
response_class=JSONResponse,
deprecated="更新插件", # type: ignore
description="更新插件", # type: ignore
)
async def _(param: PluginIr) -> Result:
try:
@@ -77,7 +77,7 @@ async def _(param: PluginIr) -> Result:
dependencies=[authentication()],
response_model=Result,
response_class=JSONResponse,
deprecated="移除插件", # type: ignore
description="移除插件", # type: ignore
)
async def _(param: PluginIr) -> Result:
try: