diff --git a/src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabHook.cs b/src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabHook.cs index 45f997e0..68d0e032 100644 --- a/src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabHook.cs +++ b/src/Infrastructure/BotSharp.Core.Crontab/Abstraction/ICrontabHook.cs @@ -5,6 +5,10 @@ public interface ICrontabHook string[]? Triggers => null; + void OnAuthenticate(CrontabItem item) + { + } + Task OnCronTriggered(CrontabItem item) => Task.CompletedTask; diff --git a/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabService.cs b/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabService.cs index cf4e1846..7ff105c9 100644 --- a/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabService.cs +++ b/src/Infrastructure/BotSharp.Core.Crontab/Services/CrontabService.cs @@ -115,11 +115,12 @@ public class CrontabService : ICrontabService, ITaskFeeder public async Task ScheduledTimeArrived(CrontabItem item) { _logger.LogDebug($"ScheduledTimeArrived {item}"); - + await HookEmitter.Emit(_services, async hook => { if (hook.Triggers == null || hook.Triggers.Contains(item.Title)) { + hook.OnAuthenticate(item); await hook.OnTaskExecuting(item); await hook.OnCronTriggered(item); await hook.OnTaskExecuted(item);