public async Task Poll()
        {
            var changedBoxingScores = await ParseForLeaderboardChanges(GameType.Boxing);

            var changedSwordsScores = await ParseForLeaderboardChanges(GameType.Swording);

            var changedShootingScores = await ParseForLeaderboardChanges(GameType.Shooting);

            var changedWeaponMasterScores = await ParseForLeaderboardChanges(GameType.WeaponMastery);

            string reply = string.Empty;

            if (changedBoxingScores.Count > 0)
            {
                reply += "New Boxing Scores:\n";
                foreach (var score in changedBoxingScores)
                {
                    reply += $"{score.Ranking}:\t{score.PlayerName}\t({score.Points})\n";
                }
            }
            if (changedSwordsScores.Count > 0)
            {
                reply += "\nNew Swords Scores:\n";
                foreach (var score in changedSwordsScores)
                {
                    reply += $"{score.Ranking}:\t{score.PlayerName}\t({score.Points})\n";
                }
            }
            if (changedShootingScores.Count > 0)
            {
                reply += "\nNew Shooting Scores:\n";
                foreach (var score in changedShootingScores)
                {
                    reply += $"{score.Ranking}:\t{score.PlayerName}\t({score.Points})\n";
                }
            }
            if (changedWeaponMasterScores.Count > 0)
            {
                reply += "\nNew Weapon Master Scores:\n";
                foreach (var score in changedWeaponMasterScores)
                {
                    reply += $"{score.Ranking}:\t{score.PlayerName}\t({score.Points})\n";
                }
            }

            //Deal with long messages
            if (reply.Length > 2000)
            {
                for (int i = 0; reply.Length > 2000; i++)
                {
                    await VIROBot.SendToScoreChannel(reply.Substring(0, reply.Length > 2000 ? 2000 : reply.Length));

                    reply = reply.Substring(2000);
                }
            }
            if (reply.Length > 0)
            {
                await VIROBot.SendToScoreChannel(reply);
            }
        }
Exemple #2
0
        static void Main(string[] args)
        {
            //Load server config
            Config.LoadConfig();

            //Start Discord bot
#if DEBUG
            var serverName = "Beat Saber Testing Server";
#else
            var serverName = "VIRO MOVE";
#endif

#if DEBUG
            ulong scoreChannel = 624102490480312330; //"event-scores";
#else
            ulong scoreChannel = 588345302453583888; //"lets-chat";
#endif
            VIROBot.Start(serverName, scoreChannel);

            Console.ReadLine();
        }