/// <summary> /// 初始化部分服务 /// </summary> private static void MakeItWork(IHyperaiApplication app) { // NOTE: search all units here app.Provider.GetRequiredService <IUnitService>().SearchForUnits(); IBotService service = app.Provider.GetRequiredService <IBotService>(); foreach (Type type in PluginManager.Instance.GetManagedPlugins()) { PluginBase plugin = PluginManager.Instance.Activate(type); plugin.ConfigureBots(service.Builder); logger.LogInformation("Plugin ({}) activated.", plugin.Context.Meta.Identity); } }
/// <summary> /// 初始化部分服务 /// </summary> private static void ConfigurePlugins(IHyperaiApplication app) { // NOTE: search all units here app.Provider.GetRequiredService <IUnitService>().SearchForUnits(); var service = app.Provider.GetRequiredService <IBotService>(); var config = app.Provider.GetRequiredService <IConfiguration>(); foreach (var type in PluginManager.Instance.GetManagedPlugins()) { var plugin = PluginManager.Instance.Activate(type); plugin.ConfigureBots(service.Builder, config); plugin.PostConfigure(config); _logger.LogInformation("Plugin ({}) activated.", plugin.Context.Meta.Identity); } }
public static IHyperaiApplication Run(this IHyperaiApplication app) { app.StartAsync().Wait(); return(app); }