Discord.Net
Discord.Net copied to clipboard
[Bug]: GetBansAsync() cannot get more than 1000 Users
Check The Docs
- [X] I double checked the docs and couldn't find any useful information.
Verify Issue Source
- [x] I verified the issue was caused by Discord.Net.
Check your intents
- [X] I double checked that I have the required intents.
Description
Guild.GetBansAsync() cannot get more than 1000 Users.
Version
Discord.Net 3.5.0
Working Version
Discord.Net 3.4.1
Logs
No response
Sample
public async Task Unban([Leftover] string user)
{
var bans = await ctx.Guild.GetBansAsync(limit: 25000).FlattenAsync().ConfigureAwait(false);
var bun = bans.FirstOrDefault(x => x.User.ToString()?.ToLowerInvariant() == user.ToLowerInvariant());
if (bun is null)
{
return;
}
await UnbanInternal(bun.User).ConfigureAwait(false);
}
Packages
No response
You can only get 1,000 per request at a time, you'll have to navigate the collection rather than flattening a single collection for it.
https://discord.com/developers/docs/resources/guild#get-guild-bans
@exsersewo Shouldn't it work the same way as the GetMessagesAsync()?
It does, the intended behavior is to make calls until the self-defined limit is reached. Currently trying to figure out what is causing this to close out at 1000.