#how to get every members from a role

1 messages · Page 1 of 1 (latest)

grand plover
#

Hello, how to get every members who have a role ?

hushed owl
#

Get all user and filter with Linq ig

pseudo yoke
#

You'd have to query for all members (Get/RequestGuildMembersAsync) and filter from there

zenith cedar
pseudo yoke
#

Well,

#

hans tag lcs

arctic rampartBOT
# pseudo yoke hans tag lcs

The library requires lower-intermediate level of familiarity with C#, as well as .NET TAP. If you're not sure where to start, check out these links:

C# tutorial series for absolute beginners: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/, https://channel9.msdn.com/Series/C-Fundamentals-for-Absolute-Beginners
Task-based Asynchronous Pattern (TAP): https://docs.microsoft.com/en-us/dotnet/standard/asynchronous-programming-patterns/task-based-asynchronous-pattern-tap

Bonus readings:
LINQ: https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/ (it is recommended you use method syntax, as mentioned here https://docs.microsoft.com/en-us/dotnet/csharp/programming-guide/concepts/linq/query-syntax-and-method-syntax-in-linq - syntax method is far more powerful and flexible)

pseudo yoke
#

Good resources

#

However what I was saying is that if you call the GetAllMembers method on a DiscordGuild, you're given a list of all members from the server, which you can then use LINQ (if you're familiar with methods like .Where, .First, etc) to filter for whatever you're looking for

zenith cedar
#

thank you a lot ^^ I'll try to see if I can get things running