示例#1
0
        private async Task ReadyAsync()
        {
            await bot.SetStatusAsync(UserStatus.Online);

            // Load the TopGG API Token
            string tokenLoc = Path.Combine(AppContext.BaseDirectory, "config/topgg.token");

            if (File.Exists(tokenLoc))
            {
                TOPGG_TOKEN = File.ReadAllText(tokenLoc);
            }
            else
            {
                await Util.LoggerAsync(new LogMessage(LogSeverity.Error, "TopGG", $"TopGG Token does not exist at {tokenLoc}."));
            }

            // Set the guild count for the bot
            var updateCounts = Task.Run(async() =>
            {
                await UpdateTopGGStats();
            });

            // Clear up any old game renders...
            var clearGames = Task.Run(async() =>
            {
                var files = Directory.GetFiles(Path.Combine("textures", "games"));
                foreach (string p in files)
                {
                    File.Delete(p);
                }
            });

            // Set the custom status once every 5 mins
            var status = Task.Run(async() => {
                bool flick = true;
                while (true)
                {
                    if (flick)
                    {
                        await bot.SetGameAsync($"use -help {EmojiUtil.GetRandomHeartEmoji()}", type: ActivityType.Streaming);
                    }
                    else
                    {
                        await bot.SetGameAsync($"use -changelog {EmojiUtil.GetRandomHeartEmoji()}", type: ActivityType.Streaming);
                    }
                    flick = !flick;
                    await Task.Delay(60000 * 5);
                }
            });

            await ProfileDatabase.ProcessUsers();

            //await ModerationDatabase.ProcessBansAsync();
        }