Exemplo n.º 1
0
        private async Task InitializeTimers(bool allShardsLoggedIn)
        {
            if (!allShardsLoggedIn)
            {
                return;
            }

            // We need to load the cache on program start.
            await MemoryCache.Initialize();

            await ConsoleLogger.LogAsync("Memory Cache timer initialized", LogLvl.INFO);

            await KaguyaStatsFactory.Initialize();

            await ConsoleLogger.LogAsync("Kaguya stats updater initialized", LogLvl.INFO);

            await AntiRaidService.Initialize();

            await ConsoleLogger.LogAsync("Antiraid service initialized", LogLvl.INFO);

            await AutoUnmuteHandler.Initialize();

            await ConsoleLogger.LogAsync("Unmute handler initialized", LogLvl.INFO);

#if !DEBUG
            await OwnerGiveawayMessageUpdaterService.Initialize();

            await ConsoleLogger.LogAsync("Owner giveaway message updater initialized", LogLvl.INFO);

            await KaguyaPremiumRoleHandler.Initialize();

            await ConsoleLogger.LogAsync("Kaguya Premium role handler initialized", LogLvl.INFO);

            await KaguyaPremiumExpirationHandler.Initialize();

            await ConsoleLogger.LogAsync("Kaguya Premium expiration handler initialized", LogLvl.INFO);

            await RateLimitService.Initialize();

            await ConsoleLogger.LogAsync("Ratelimit service initialized", LogLvl.INFO);

            await StatsUpdater.Initialize();

            await ConsoleLogger.LogAsync("Top.gg stats updater initialized", LogLvl.INFO);

            await RemindService.Initialize();

            await ConsoleLogger.LogAsync("Remind service initialized", LogLvl.INFO);

            await UpvoteExpirationNotifier.Initialize();

            await ConsoleLogger.LogAsync("Upvote expiration notification timer initialized", LogLvl.INFO);

            await GameRotationService.Initialize();

            await ConsoleLogger.LogAsync("Game rotation timer initialized", LogLvl.INFO);
#endif
            await ConsoleLogger.LogAsync("All timers initialized.", LogLvl.INFO);
        }
Exemplo n.º 2
0
        public async Task Command()
        {
            GameRotationService.Resume();
            await GameRotationService.SetToDefault();

            await SendBasicSuccessEmbedAsync($"{Context.User.Mention} successfully re-enabled the game rotation service " +
                                             $"and set the currently playing game back to the default value.");
        }
Exemplo n.º 3
0
        public async Task Command(string username, string timeStr = "2h")
        {
            TimeSpan time = timeStr.ParseToTimespan();
            string   url  = "https://www.twitch.tv/" + username;
            await Client.SetGameAsync("Live now!", url, ActivityType.Streaming);

            GameRotationService.Pause(time);

            await SendBasicSuccessEmbedAsync($"Successfully set the stream to `{url}`.\n" +
                                             $"This will remain active for `{time.Humanize(2)}`");
        }
Exemplo n.º 4
0
        public async Task Command(string text, int num = 0)
        {
            if (num > 3 || num < 0)
            {
                await SendBasicErrorEmbedAsync("The activity number must be between 0 and 3. Your number " +
                                               "was " +
                                               num);

                return;
            }

            var type = (ActivityType)num;
            await GameRotationService.Set(text, type);

            await SendBasicSuccessEmbedAsync($"{Context.User.Mention} Succesfully set the game to:\n" +
                                             $"{type.Humanize(LetterCasing.Sentence)} {text}");
        }