Exemplo n.º 1
0
        public SizeCheckingHandler(IWolfClient client,
                                   ILogger <SizeCheckingHandler> logger, IHostEnvironment environment, IHttpClientFactory httpClientFactory,
                                   IUserDataStore userDataStore, IGroupConfigStore groupConfigStore,
                                   IOptionsMonitor <SizeCheckingOptions> picSizeOptions, IOptionsMonitor <BotOptions> botOptions, IOptionsMonitor <CommandsOptions> commandsOptions)
        {
            // store all services
            this._client            = client;
            this._log               = logger;
            this._environment       = environment;
            this._httpClientFactory = httpClientFactory;
            this._userDataStore     = userDataStore;
            this._groupConfigStore  = groupConfigStore;
            this._picSizeOptions    = picSizeOptions;
            this._botOptions        = botOptions;
            this._commandsOptions   = commandsOptions;

            this._cts = new CancellationTokenSource();

            // add client listeners
            this._client.AddMessageListener <ChatMessage>(OnChatMessage);

            // read options
            this.OnPicSizeOptionsReload(picSizeOptions.CurrentValue);
            picSizeOptions.OnChange(this.OnPicSizeOptionsReload);
        }
Exemplo n.º 2
0
 public NextGameHandler(IGroupConfigStore groupConfigStore, IOptionsSnapshot <BotOptions> botOptions, IOptionsSnapshot <NextGameOptions> nextGameOptions, ILogger <NextGameHandler> log)
 {
     // store all services
     this._log              = log;
     this._botOptions       = botOptions.Value;
     this._groupConfigStore = groupConfigStore;
     this._nextGameOptions  = nextGameOptions.Value;
 }
Exemplo n.º 3
0
 public CacheAdminHandler(IUserDataStore userDataStore, IIdQueueStore idQueueStore, IGroupConfigStore groupConfigStore, IUserDataCache userDataCache, IGroupConfigCache groupConfigCache, IIdQueueCache idQueueCache, IMentionConfigCache mentionConfigCache, ILogger <CacheAdminHandler> logger)
 {
     // store all services
     this._log = logger;
     // caches
     this._groupConfigCache   = groupConfigCache;
     this._userDataCache      = userDataCache;
     this._idQueueCache       = idQueueCache;
     this._mentionConfigCache = mentionConfigCache;
     // stores
     this._userDataStore    = userDataStore;
     this._idQueueStore     = idQueueStore;
     this._groupConfigStore = groupConfigStore;
 }
Exemplo n.º 4
0
        public CacheCleaner(ILogger <CacheCleaner> logger, IOptionsMonitor <CachingOptions> cachingOptions,
                            IUserDataStore userDataStore, IIdQueueStore idQueueStore, IGroupConfigStore groupConfigStore,
                            IUserDataCache userDataCache, IGroupConfigCache groupConfigCache, IIdQueueCache idQueueCache, IMentionConfigCache mentionConfigCache)
        {
            this._log            = logger;
            this._cachingOptions = cachingOptions;
            // caches
            this._userDataCache      = userDataCache;
            this._groupConfigCache   = groupConfigCache;
            this._idQueueCache       = idQueueCache;
            this._mentionConfigCache = mentionConfigCache;
            // stores
            this._userDataStore    = userDataStore;
            this._idQueueStore     = idQueueStore;
            this._groupConfigStore = groupConfigStore;

            this._optionsChangeHandle = this._cachingOptions.OnChange(_ =>
            {
                this.RestartAllLoops();
            });
        }
Exemplo n.º 5
0
 public static Task SetGroupConfigAsync(this IGroupConfigStore store, GroupConfig config, CancellationToken cancellationToken = default)
 => store.SetGroupConfigAsync(config, true, cancellationToken);