feat(automation): add daily briefing preset and cron backup scheduling
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
import type { Config } from '../config/index.js';
|
||||
import type { HookEngine } from '../hooks/index.js';
|
||||
import { ChannelRegistry, TelegramAdapter, WebChatAdapter, DiscordAdapter, SlackAdapter, WhatsAppAdapter, MatrixAdapter, SignalAdapter, MattermostAdapter, TeamsAdapter, GoogleChatAdapter, BlueBubblesAdapter, LineAdapter, FeishuAdapter, ZaloAdapter, PairingManager } from '../channels/index.js';
|
||||
import { CronScheduler, WebhookHandler, GmailWatcher } from '../automation/index.js';
|
||||
import { CronScheduler, WebhookHandler, GmailWatcher, buildPresetCronJobs } from '../automation/index.js';
|
||||
import type { GatewayServer } from '../gateway/index.js';
|
||||
|
||||
export interface ChannelsDeps {
|
||||
@@ -202,10 +202,12 @@ export function registerChannels(deps: ChannelsDeps): ChannelsResult {
|
||||
|
||||
// Register cron scheduler adapter (if any cron jobs configured)
|
||||
let cronScheduler: CronScheduler | undefined;
|
||||
if (config.automation.cron.length > 0) {
|
||||
cronScheduler = new CronScheduler(config.automation.cron, channelRegistry, config.automation.delivery_mode);
|
||||
const presetCronJobs = buildPresetCronJobs(config);
|
||||
const cronJobs = [...config.automation.cron, ...presetCronJobs];
|
||||
if (cronJobs.length > 0) {
|
||||
cronScheduler = new CronScheduler(cronJobs, channelRegistry, config.automation.delivery_mode);
|
||||
channelRegistry.register(cronScheduler);
|
||||
console.log(`Registered ${config.automation.cron.length} cron job(s)`);
|
||||
console.log(`Registered ${cronJobs.length} cron job(s)`);
|
||||
}
|
||||
|
||||
// Register webhook handler adapter (if any webhooks configured)
|
||||
|
||||
Reference in New Issue
Block a user