Esempio n. 1
0
        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());
        }
Esempio n. 2
0
        public static async Task <DiscordBan> GetBanAsync(this DiscordGuild guild, DiscordUser user)
        {
            var GuildBans = await guild.GetBansAsync();

            return(GuildBans.FirstOrDefault(xr => xr.User == user));
        }
Esempio n. 3
0
 public async Task <IEnumerable <BannedMember> > GetBansAsync(DiscordGuild guild) =>
 (await guild.GetBansAsync()).Select(ban => new BannedMember(ban.User.Id, ban.Reason));