public async Task Scheduled() { FumbblScraper fs = new FumbblScraper(); List <UpcomingGame> games = new List <UpcomingGame>(); // TODO get scheduled games for all /tg/ groups games.AddRange(fs.GetUpcomingMatches(LEAGUE_MAIN)); games.AddRange(fs.GetUpcomingMatches(LEAGUE_SECRET)); if (games.Count == 0) { await ReplyAsync("There are no scheduled games"); } else { EmbedBuilder eb = new EmbedBuilder(); eb.WithTitle("Scheduled Games"); eb.WithColor(Color.DarkPurple); eb.WithThumbnailUrl("https://i.imgur.com/QTzpQlD.png"); foreach (UpcomingGame game in games) { eb.AddField(game.Date.ToString("dd-MM HH:mm UTC+02"), string.Format("({2}) **{0}** vs **{1}**", game.TeamA, game.TeamB, sql.GetTeamMatch(game.TeamA))); } Embed e = eb.Build(); await ReplyAsync(string.Empty, embed : e); } }
public async Task Today() { FumbblScraper fs = new FumbblScraper(); // TODO get scheduled games for all /tg/ groups List <UpcomingGame> games = fs.GetUpcomingMatches(LEAGUE_MAIN); if (games.Count == 0) { await ReplyAsync("There are no scheduled games"); } else { Logger.Log(games.Count); EmbedBuilder eb = new EmbedBuilder(); eb.WithTitle("Today's games"); eb.WithColor(Color.DarkPurple); eb.WithThumbnailUrl("https://i.imgur.com/QTzpQlD.png"); foreach (UpcomingGame game in games) { Logger.Log(game.Date); if (DateTime.Now.Date.Equals(game.Date.Date)) { TimeSpan left = game.Date - DateTime.Now; string leftstring = string.Format("{0}h {1}m", left.Hours, left.Minutes); eb.AddField(string.Format(":id: {0}", sql.GetTeamMatch(game.TeamA)), string.Format("**{0}** vs **{1}** \n :alarm_clock: {2} :arrow_left: *{3} left*", game.TeamA, game.TeamB, game.Date.ToString("HH:mm UTC+02"), leftstring)); } } if (eb.Fields.Count == 0) { await ReplyAsync("There are no games scheduled for today"); } else { Embed e = eb.Build(); await ReplyAsync(string.Empty, embed : e); } } }