public async Task RegisterAsync(int year, [Remainder] ulong leagueId) { var existingLeague = await _leagueDbRepository.GetLeague(year, leagueId); if (existingLeague != null) { await ReplyAsync("That league already exists with this channel"); } else { var onlineLeague = await _leagueApiRepository.GetLeague(year, leagueId); if (onlineLeague != null) { onlineLeague.Year = year; onlineLeague.GuildId = Context.Guild.Id; await _leagueDbRepository.AddLeague(onlineLeague); await ReplyAsync("That league has been registered to this discord channel."); } else { await ReplyAsync("That league does not exist on ESPN.com, or you do not have access to it"); } } }
public async Task LeagueAsync() { var res = await _leagueApiRepository.GetLeague(2019, 228841); var list = string.Join(", ", res.Teams.Select(x => x.Nickname)); await ReplyAsync(list); }