public async Task <BannedMember[]> GetBansAsync(DiscordGuild guild) { var bannedUsersArray = await guild.GetBansAsync(); var bannedUsersList = new List <BannedMember>(); foreach (var ban in bannedUsersArray.ToArray()) { bannedUsersList.Add(new BannedMember() { ID = ban.User.Id, Reason = ban.Reason }); } return(bannedUsersList.ToArray()); }
public static async Task <DiscordBan> GetBanAsync(this DiscordGuild guild, DiscordUser user) { var GuildBans = await guild.GetBansAsync(); return(GuildBans.FirstOrDefault(xr => xr.User == user)); }
public async Task <IEnumerable <BannedMember> > GetBansAsync(DiscordGuild guild) => (await guild.GetBansAsync()).Select(ban => new BannedMember(ban.User.Id, ban.Reason));