mirror of
https://github.com/zhenxun-org/zhenxun_bot.git
synced 2026-10-06 12:20:00 +08:00
✨ 资源下载分离 (#1814)
* 🚀 资源文件单独下载,分离被动任务初始化 * 🔥 移除resources文件夹 * 🚀 优化版本更新逻辑,增加资源下载异常处理 * 🚀 增加资源下载失败异常处理及提示信息 * 🚀 增加资源下载选项及异常处理优化 * 🚀 移除空ID检查及资源更新条件处理 * ✨ 简易配置中未加载的配置将被移除 * 🐛 测试更新 * ✨ 修复更新完成消息格式 --------- Co-authored-by: Flern <cb56ec362bbbfb5272eb941281299d8d-qq_connect@git.osc>
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
from collections.abc import Callable
|
||||
import copy
|
||||
from datetime import datetime
|
||||
from pathlib import Path
|
||||
from typing import Any
|
||||
from typing import Any, Literal
|
||||
|
||||
import cattrs
|
||||
from pydantic import BaseModel
|
||||
@@ -157,6 +158,29 @@ class PluginSetting(BaseModel):
|
||||
"""调用插件花费金币"""
|
||||
|
||||
|
||||
class SchedulerModel(BaseModel):
|
||||
trigger: Literal["date", "interval", "cron"]
|
||||
"""trigger"""
|
||||
day: int | None = None
|
||||
"""天数"""
|
||||
hour: int | None = None
|
||||
"""小时"""
|
||||
minute: int | None = None
|
||||
"""分钟"""
|
||||
second: int | None = None
|
||||
"""秒"""
|
||||
run_date: datetime | None = None
|
||||
"""运行日期"""
|
||||
id: str | None = None
|
||||
"""id"""
|
||||
max_instances: int | None = None
|
||||
"""最大运行实例"""
|
||||
args: list | None = None
|
||||
"""参数"""
|
||||
kwargs: dict | None = None
|
||||
"""参数"""
|
||||
|
||||
|
||||
class Task(BaseBlock):
|
||||
module: str
|
||||
"""被动技能模块名"""
|
||||
@@ -168,8 +192,14 @@ class Task(BaseBlock):
|
||||
"""初次加载默认开关状态"""
|
||||
default_status: bool = True
|
||||
"""进群时默认状态"""
|
||||
run_time: str | None = None
|
||||
"""运行时间"""
|
||||
scheduler: SchedulerModel | None = None
|
||||
"""定时任务配置"""
|
||||
run_func: Callable | None = None
|
||||
"""运行函数"""
|
||||
check: Callable | None = None
|
||||
"""检查函数"""
|
||||
check_args: list = []
|
||||
"""检查函数参数"""
|
||||
|
||||
|
||||
class PluginExtraData(BaseModel):
|
||||
|
||||
Reference in New Issue
Block a user