public TempUnverifyService(IOptions <Configuration> config, BotLoggingService logger, DiscordSocketClient client) { Data = new List <TempUnverifyItem>(); Config = config.Value; Logger = logger; Client = client; }
public BackgroundTaskScheduler(BackgroundTaskQueue queue, IServiceProvider provider, BotLoggingService botLoggingService) { Queue = queue; Provider = provider; BotLoggingService = botLoggingService; LastSchedulesAt = new Dictionary <Type, DateTime>(); }
protected LoggerMethodBase(DiscordSocketClient client, Configuration config, IMessageCache messageCache, HttpClient httpClient, BotLoggingService loggingService) { Client = client; Config = config; MessageCache = messageCache; HttpClient = httpClient; LoggingService = loggingService; }
public ChannelStats(IOptions <Configuration> config, BotLoggingService loggingService) { Changes = new HashSet <ulong>(); WebTokens = new List <ChannelboardWebToken>(); Counters = new Dictionary <ulong, ChannelStat>(); LoggingService = loggingService; Config = config.Value; }
public Logger(DiscordSocketClient client, IOptions <Configuration> config, IMessageCache messageCache, BotLoggingService loggingService) { Client = client; Config = config.Value; MessageCache = messageCache; LoggingService = loggingService; Counters = new Dictionary <string, uint>(); HttpClient = new HttpClient(); }
public InitService(IServiceProvider provider, BotLoggingService botLoggingService) { BotLoggingService = botLoggingService; var initiableName = typeof(IInitiable).Name; Initiables = Assembly.GetExecutingAssembly().GetTypes() .Where(t => t.GetInterface(initiableName) != null) .Select(t => (IInitiable)provider.GetService(t)) .Where(o => o != null) .ToList(); }
public EmoteStats(IOptions <Configuration> config, BotLoggingService loggingService) { Config = config.Value; Counter = new Dictionary <string, EmoteStat>(); Changes = new HashSet <string>(); LoggingService = loggingService; var syncPeriod = GrillBotService.DatabaseSyncPeriod; DbSyncTimer = new Timer(SyncTimerCallback, null, syncPeriod, syncPeriod); }
protected override async Task ExecuteAsync(CancellationToken stoppingToken) { var scheduleable = typeof(IBackgroundTaskScheduleable); var serviceTypes = Assembly.GetExecutingAssembly() .GetTypes() .Where(o => o.GetInterface(scheduleable.FullName) != null) .ToList(); if (serviceTypes.Count == 0) { return; } while (!stoppingToken.IsCancellationRequested) { try { using var scope = Provider.CreateScope(); foreach (var type in serviceTypes) { if (scope.ServiceProvider.GetService(type) is not IBackgroundTaskScheduleable service) { continue; } if (service.CanScheduleTask(GetLastSchedule(type))) { foreach (var task in service.GetBackgroundTasks()) { Queue.Add(task); } LastSchedulesAt[type] = DateTime.Now; } } } catch (Exception ex) { var message = new LogMessage(LogSeverity.Error, nameof(BackgroundTaskScheduler), "Scheduling tasks failed.", ex); await BotLoggingService.OnLogAsync(message); } finally { await Task.Delay(TimeSpan.FromMinutes(1), stoppingToken); } } }
public UnverifyService(UnverifyChecker checker, UnverifyProfileGenerator profileGenerator, UnverifyLogger logger, UnverifyMessageGenerator messageGenerator, UnverifyTimeParser timeParser, BotState botState, DiscordSocketClient discord, BotLoggingService loggingService, ILogger <UnverifyService> appLogger, IGrillBotRepository grillBotRepository, BackgroundTaskQueue queue) { Checker = checker; UnverifyProfileGenerator = profileGenerator; UnverifyLogger = logger; MessageGenerator = messageGenerator; TimeParser = timeParser; BotState = botState; DiscordClient = discord; Logger = loggingService; AppLogger = appLogger; GrillBotRepository = grillBotRepository; Queue = queue; }
public MessageDeleted(DiscordSocketClient client, Configuration config, IMessageCache messageCache, HttpClient httpClient, BotLoggingService loggingService) : base(client, config, messageCache, httpClient, loggingService) { }
public MessageCache(DiscordSocketClient client, BotLoggingService loggingService) { Data = new Dictionary <ulong, IMessage>(); Client = client; LoggingService = loggingService; }
public AutoReplyService(IOptions <Configuration> configuration, BotLoggingService botLogging) { Data = new List <AutoReplyItem>(); BotLogging = botLogging; Config = configuration.Value; }
public LogMiddleware(RequestDelegate next, BotLoggingService loggingService) { Next = next; LoggingService = loggingService; }