Ejemplo n.º 1
0
        public SingleLaunchCommands(OddityCore oddity, CacheService cacheService, LaunchNotificationsService launchNotificationsService, LaunchInfoEmbedGenerator launchInfoEmbedGenerator)
        {
            _oddity       = oddity;
            _cacheService = cacheService;
            _launchNotificationsService = launchNotificationsService;
            _launchInfoEmbedGenerator   = launchInfoEmbedGenerator;

            _cacheService.RegisterDataProvider(CacheContentType.AllLaunches, async p => await _oddity.LaunchesEndpoint.GetAll().ExecuteAsync());
            _cacheService.RegisterDataProvider(CacheContentType.NextLaunch, async p => await _oddity.LaunchesEndpoint.GetNext().ExecuteAsync());
            _cacheService.RegisterDataProvider(CacheContentType.LatestLaunch, async p => await _oddity.LaunchesEndpoint.GetLatest().ExecuteAsync());
        }
        public UserLaunchSubscriptionsService(CacheService cacheService, LaunchInfoEmbedGenerator launchInfoEmbedGenerator)
        {
            _cacheService             = cacheService;
            _launchInfoEmbedGenerator = launchInfoEmbedGenerator;

            Bot.Client.MessageReactionAdded   += ClientOnMessageReactionAdded;
            Bot.Client.MessageReactionRemoved += ClientOnMessageReactionRemoved;

            _notificationsUpdateTimer          = new Timer(UpdateNotificationsIntervalMinutes * 60 * 1000);
            _notificationsUpdateTimer.Elapsed += Notifications_UpdateTimerOnElapsedAsync;
            _notificationsUpdateTimer.Start();
        }