Discord.net: Can`t get full list of user

Created on 12 Feb 2019  路  4Comments  路  Source: discord-net/Discord.Net

I tried to get all user list of my guild (400members).
But,returned response has just 270 users.
This is sample of my source code.
How to get full user list of my guild ? Thany kou!

Discord.NET 2.0.1
.Net Frame Wordk 4.6.1

var client = new DiscordSocketClient();
var token = "secret"
await client.LoginAsync(TokenType.Bot, token);
await client.StartAsync();
//this returned users list has just  270 elements.
var users=client.Guilds.ToList()[0].Users.ToList();

All 4 comments

Guild information isn't completed in its retrieval and processing until the Ready event is fired. Put all your logic in an event handler for that.

SocketGuild.Users returns a list of cached users. You need to download the users to get the full user set.

In addition, you should likely not be using ToList, as the data returned is in a format which can be used the same anyway.

I could get all user finally !
Thank you, everone for kind advice.
I'll keep studying, and work hard.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Kwoth picture Kwoth  路  8Comments

MinisBett picture MinisBett  路  3Comments

Poyser1911 picture Poyser1911  路  4Comments

foxbot picture foxbot  路  4Comments

TheBlue-1 picture TheBlue-1  路  3Comments