public static async Task StartServiceHandlers(IServiceProvider provider) { _logger = provider.GetService <LogChannelService>(); _config = provider.GetService <Config>(); _mongo = provider.GetService <MongoClient>(); Logger.Info("Installing CommandHandler"); await CommandHandler.Install(provider); await CommandHandler.ConfigureAsync(); Logger.Info("Installing FAQ Service"); await FaqService.Install(provider); await FaqService.LoadFaqs(); Logger.Info("Installing AntiAds Service"); await AntiAds.AntiAds.Install(provider); await AntiAds.AntiAds.StartAsync(); Logger.Info("Installing Violations Service"); await Violations.Violations.Install(provider); Logger.Info("Loading JobQueue"); await JobQueue.Install(provider); _client.JoinedGuild += JoinedGuild; _client.LeftGuild += LeftGuild; }
public static async Task StartServiceHandlers(IServiceProvider provider) { _client = provider.GetService <DiscordShardedClient>(); _channellogger = provider.GetService <LogChannelService>(); _config = provider.GetService <IConfigurationRoot>(); _unit = provider.GetService <IUnitOfWork>(); _factory = provider.GetService <ILoggerFactory>(); _logger = _factory.CreateLogger(typeof(EventHandlers)); var adsService = provider.GetService <AntiAdsService>(); var cmdService = provider.GetService <CommandService>(); var faqService = provider.GetService <FaqService>(); var githubService = provider.GetService <GithubService>(); await ReadyLogger(); _handler = new CommandHandler(provider); await _handler.LoadModulesAndStartAsync(); _logger.LogInformation(new EventId(200), "Created & Started CommandHandler"); await faqService.LoadFaqsAsync(); _logger.LogInformation(new EventId(200), "Installed and loaded FAQ Service"); adsService.StartService(); _logger.LogInformation(new EventId(200), "Started AntiAds Service"); await JobQueue.Install(provider); _logger.LogInformation(new EventId(200), "Loaded JobQueue"); await githubService.StartAsync(); _logger.LogInformation(new EventId(200), "Started Github service"); _client.Log += ClientLogger; cmdService.Log += CommandLogger; _client.JoinedGuild += JoinedGuild; _client.LeftGuild += LeftGuild; }