Discore
Show / Hide Table of Contents

Method RequestGuildMembersAsync

| Improve this Doc View Source

RequestGuildMembersAsync(Snowflake, string, int, CancellationToken?)

Requests guild members from the Discord API, this can be used to retrieve offline members in a guild that is considered "large". "Large" guilds will not automatically have the offline members available.

Declaration
Task RequestGuildMembersAsync(Snowflake guildId, string query = "", int limit = 0, CancellationToken? cancellationToken = null)
Parameters
Type Name Description
Snowflake guildId

The ID of the guild to retrieve members from.

string query

Case-insensitive string that the username starts with, or an empty string to request all members.

int limit

Maximum number of members to retrieve or 0 to request all members matched.

CancellationToken? cancellationToken

A token used to cancel the request.

Returns
Type Description
Task
Remarks

Members requested here will be available through the OnGuildMembersChunk event.

Note: This method will also throw an OperationCanceledException if the Gateway's shard is stopped while sending.

This method will wait until the underlying Gateway connection is ready as well as retry if the connection closes unexpectedly until the given cancellation token is cancelled or the Gateway's shard is stopped.
Exceptions
Type Condition
ArgumentNullException

Thrown if query is null.

InvalidOperationException

Thrown if the Gateway's shard has not been fully started.

ObjectDisposedException

Thrown if the Gateway's shard has been disposed.

OperationCanceledException

Thrown if the cancellation token is cancelled or the Gateway's shard is stopped while sending.

  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX