feat(plugin-schedule): add DB-driven plugin scheduler and xiuren scheduled push

This commit is contained in:
liuwei
2026-04-16 15:24:23 +08:00
parent 9d6609990b
commit 014985ac4a
9 changed files with 854 additions and 0 deletions

View File

@@ -72,3 +72,34 @@ class MessagePluginInterface(PluginInterface):
(是否已处理, 处理结果)
"""
raise NotImplementedError("子类必须实现此方法")
# ---------------- 插件定时调度能力(可选实现) ----------------
def get_schedule_actions(self) -> List[Dict[str, Any]]:
"""返回插件支持的可调度动作定义列表。
每项示例:
{
"action_key": "daily_push",
"name": "每日推送",
"description": "给目标群发送每日内容",
"trigger_type": "at_times",
"trigger_config": {"time_list": ["09:00"]},
"target_scope": "all_enabled_groups",
"target_config": {},
"payload": {},
"default_enabled": False
}
"""
return []
async def run_scheduled_action(self, action_key: str, context: Dict[str, Any]) -> Dict[str, Any]:
"""执行调度动作(插件可覆盖)。
Returns:
dict: {"success": bool, "summary": str, "detail": dict}
"""
return {
"success": False,
"summary": f"插件未实现调度动作: {action_key}",
"detail": {"action_key": action_key},
}