DSharpPlus/Entities/Guild/DiscordGuild.cs
/// <summary>
/// Requests that Discord send a list of guild members based on the specified arguments. This method will fire the <see cref="DiscordClient.GuildMembersChunked"/> event.
/// <para>If no arguments aside from <paramref name="presences"/> and <paramref name="nonce"/> are specified, this will request all guild members.</para>
/// </summary>
/// <param name="query">Filters the returned members based on what the username starts with. Either this or <paramref name="userIds"/> must not be null. 
/// The <paramref name="limit"/> must also be greater than 0 if this is specified.</param>
/// <param name="limit">Total number of members to request. This must be greater than 0 if <paramref name="query"/> is specified.</param>
/// <param name="presences">Whether to include the <see cref="EventArgs.GuildMembersChunkEventArgs.Presences"/> associated with the fetched members.</param>
/// <param name="userIds">Whether to limit the request to the specified user ids. Either this or <paramref name="query"/> must not be null.</param>
/// <param name="nonce">The unique string to identify the response.</param>
Requests that Discord send a list of guild members based on the specified arguments. This method will fire the  event.
If no arguments aside from  and  are specified, this will request all guild members.
Requests that Discord send a list of guild members based on the specified arguments . This method will fire the event . If no arguments aside from and are specified this will request all guild members .
public async Task RequestMembersAsync(string query = "", int limit = 0, bool? presences = null, IEnumerable<ulong> userIds = null, string nonce = null)
        {
            if (!(this.Discord is DiscordClient client))
                throw new InvalidOperationException("This operation is only valid for regular Discord clients.");
            if (query == null && userIds == null)
                throw new ArgumentException("The query and user IDs cannot both be null.");
            if (query != null && userIds != null)
                query = null;
            var grgm = new GatewayRequestGuildMembers(this)
            {
                Query = query,
                Limit = limit >= 0 ? limit : 0,
                Presences = presences,
                UserIds = userIds,
                Nonce = nonce
            };
            var payload = new GatewayPayload
            {
                OpCode = GatewayOpCode.RequestGuildMembers,
                Data = grgm
            };
            var payloadStr = JsonConvert.SerializeObject(payload, Formatting.None);
            await client.WsSendAsync(payloadStr).ConfigureAwait(false);
        }
public async Task RequestMembersAsync ( string query = " " , int limit = 0 , bool ? presences = null , IEnumerable < ulong > userIds = null , string nonce = null ) { if ( ! ( this . Discord is DiscordClient client ) ) throw new InvalidOperationException ( " " ) ; if ( query == null && userIds == null ) throw new ArgumentException ( " " ) ; if ( query != null && userIds != null ) query = null ; var grgm = new GatewayRequestGuildMembers ( this ) { Query = query , Limit = limit >= 0 ? limit : 0 , Presences = presences , UserIds = userIds , Nonce = nonce } ; var payload = new GatewayPayload { OpCode = GatewayOpCode . RequestGuildMembers , Data = grgm } ; var payloadStr = JsonConvert . SerializeObject ( payload , Formatting . None ) ; await client . WsSendAsync ( payloadStr ) . ConfigureAwait ( false ) ; }
Requests that Discord send a list of guild members based on the specified arguments.
Requests that Discord send a list of guild members based on the specified arguments .
query
string
Filters the returned members based on what the username starts with. Either this or  must not be null.
The  must also be greater than 0 if this is specified.
Filters the returned members based on what the username starts with . Either this or must not be null . The must also be greater than 0 if this is specified .
limit
int
Total number of members to request. This must be greater than 0 if  is specified.
Total number of members to request . This must be greater than 0 if is specified .
presences
bool?
Whether to include the  associated with the fetched members.
Whether to include the associated with the fetched members .
userIds
IEnumerable<ulong>
Whether to limit the request to the specified user ids. Either this or  must not be null.
Whether to limit the request to the specified user ids . Either this or must not be null .
nonce
string
The unique string to identify the response.
The unique string to identify the response .