using BotSharp.Abstraction.Infrastructures; namespace BotSharp.Core.Infrastructures; public static class HookEmitter { public static async Task Emit(IServiceProvider services, Action action) { var logger = services.GetRequiredService>(); var result = new HookEmittedResult(); var hooks = services.GetServices(); foreach (var hook in hooks) { try { logger.LogInformation($"Emit hook action on {action.Method.Name}({hook.GetType().Name})"); action(hook); } catch (Exception ex) { logger.LogError(ex.ToString()); } } return result; } }