public List <DiscordGuild> GetGuilds() { List <DiscordUserGuild> userGuilds = Deserialize <List <DiscordUserGuild> >(Client.Get(DiscordURL.UserGuildsURL)); List <DiscordGuild> guilds = new List <DiscordGuild>(); userGuilds.ForEach(u => { guilds.Add(Deserialize <DiscordGuild>(Client.Get(DiscordURL.GetGuildURL(u)))); }); return(guilds); }
public async Task <List <DiscordGuild> > GetGuilds() { List <DiscordUserGuild> userGuilds = Deserialize <List <DiscordUserGuild> >(await Client.Get(DiscordURL.UserGuildsURL)); List <DiscordGuild> guilds = new List <DiscordGuild>(); new Task(() => { userGuilds.ForEach(async u => { DiscordGuild guild = Deserialize <DiscordGuild>(await Client.Get(DiscordURL.GetGuildURL(u))); guilds.Add(guild); Console.WriteLine(guild.name); }); }).Wait(); Console.WriteLine("DONE"); return(guilds); }
public async Task <DiscordGuild> GetGuild(DiscordUserGuild userGuild) { DiscordGuild guild = Deserialize <DiscordGuild>(await Client.Get(DiscordURL.GetGuildURL(userGuild))); return(guild); }