Пример #1
0
 public async Task Resolve(string A, string B)
 {
     if (Context.User.Id == DiscordConstants.ID_OWNER)
     {
         Match       match = new Match("id", "tournament", "Acoach", A, "Arace", "Atv", "Bcoach", B, "Brace", "Btv", "spectatorlink", "group");
         BetResolver br    = new BetResolver();
         br.ResolveMatch(match);
         await ReplyAsync("resolving mtach");
     }
 }
Пример #2
0
        public void Run()
        {
            System.Threading.Thread.Sleep(25000);
            while (true)
            {
                // TODO wrap in MatchParser or MatchAnnouncer?
                Logger.Log("Checking live matches");
                LiveMatches = NewMatches;
                NewMatches  = matchparser.GetMatches();

                // Announce new matches
                foreach (KeyValuePair <string, Match> newmatch in NewMatches)
                {
                    if (newmatch.Value.Announced != true)
                    {
                        if (sql.IsMatchLive(sql.GetTeamMatch(newmatch.Value.HomeTeam)) != true)
                        {
                            AnnounceMatch(newmatch.Value);
                            sql.SetMatchLive(sql.GetTeamMatch(newmatch.Value.HomeTeam));
                        }
                        newmatch.Value.Announced = true;
                    }
                }

                // Resolve finished matches
                foreach (KeyValuePair <string, Match> livematch in LiveMatches)
                {
                    if (!NewMatches.ContainsKey(livematch.Key))
                    {
                        Logger.Log("resolving match");
                        // TODO make async because this can take a while to get resolved
                        betresolver.ResolveMatch(livematch.Value);
                    }
                }

                // TODO wrap in TournamentParser(?) class
                // Get scheduled matches
                Logger.Log("Parsing main league matches");
                sql.SubmitTeams(fumbblscrapper.GetScheduledMatches(fumbblscrapper.GetTournamentsInProgress("9828")));
                Logger.Log("Parsing secret league matches");
                sql.SubmitTeams(fumbblscrapper.GetScheduledMatches(fumbblscrapper.GetTournamentsInProgress("10393")));

                // Info
                Logger.Log("LiveMatches count: " + LiveMatches.Count());
                Logger.Log("NewMatches count: " + NewMatches.Count());
                Logger.Log("Finished cycle");

                System.Threading.Thread.Sleep(60000);
            }
        }