mirror of
https://github.com/Nezumi-2711/astrbot_plugin_qq_group_daily_analysis.git
synced 2026-09-22 13:38:43 +00:00
fix(AutoScheduler): 增强性处理,保持代码健壮性,增加友好提示
This commit is contained in:
+1
-1
@@ -37,7 +37,7 @@
|
||||
"type": "list",
|
||||
"description": "自动分析时间列表",
|
||||
"default": ["09:00"],
|
||||
"hint": "每日自动分析的时间点列表,格式HH:MM,支持多个时间点",
|
||||
"hint": "每日自动分析的时间点列表,格式HH:MM(例如 23:00 ),支持多个时间点",
|
||||
"items": {
|
||||
"type": "string"
|
||||
}
|
||||
|
||||
@@ -157,6 +157,9 @@ class AutoScheduler:
|
||||
target_times = []
|
||||
for t_str in time_config:
|
||||
try:
|
||||
# 预处理:替换中文冒号,去除首尾空格
|
||||
t_str = str(t_str).replace(":", ":").strip()
|
||||
|
||||
t = datetime.strptime(t_str, "%H:%M").replace(
|
||||
year=now.year,
|
||||
month=now.month,
|
||||
@@ -166,7 +169,9 @@ class AutoScheduler:
|
||||
)
|
||||
target_times.append(t)
|
||||
except ValueError:
|
||||
logger.error(f"时间格式错误: {t_str}, 应为 HH:MM")
|
||||
logger.error(
|
||||
f"时间格式错误: {t_str}, 应为 HH:MM 格式,例如 23:00"
|
||||
)
|
||||
continue
|
||||
|
||||
if not target_times:
|
||||
|
||||
Reference in New Issue
Block a user