Client

export declare class Client extends AsyncEventEmitter<MappedEvents>
export declare class Client extends AsyncEventEmitter<MappedEvents>

No summary provided.

constructor({ rest, gateway })
Constructs a new instance of the Client class
NameTypeOptionalDescription
{ rest, gateway }ClientOptionsNoNone
Readonly
api:API
Readonly
gateway:Gateway
Readonly
rest:REST
requestGuildMembers(options, timeout?):Promise<{ members: APIGuildMember[]; nonce: string; notFound: unknown[]; presences: GatewayGuildMembersChunkPresence[]; }>
Requests guild members from the gateway.
Example
Requesting specific members from a guild
const { members } = await client.requestGuildMembers({ guild_id: '1234567890', user_ids: ['9876543210'] });
const { members } = await client.requestGuildMembers({ guild_id: '1234567890', user_ids: ['9876543210'] });
NameTypeOptionalDescription
optionsGatewayRequestGuildMembersDataNoThe options for the request
timeoutnumberYesThe timeout for waiting for each guild members chunk event
requestGuildMembersIterator(options, timeout?):AsyncGenerator<{ members: APIGuildMember[]; nonce: string; notFound: unknown[] | null; presences: GatewayGuildMembersChunkPresence[] | null; chunkIndex: number; chunkCount: number; }, void, unknown>
Requests guild members from the gateway and returns an async iterator that yields the data from each guild members chunk event.
Example
Requesting all members from a guild
for await (const { members } of client.requestGuildMembersIterator({ guild_id: '1234567890', query: '', limit: 0 })) {
console.log(members);
}
for await (const { members } of client.requestGuildMembersIterator({ guild_id: '1234567890', query: '', limit: 0 })) {
console.log(members);
}
NameTypeOptionalDescription
optionsGatewayRequestGuildMembersDataNoThe options for the request
timeoutnumberYesThe timeout for waiting for each guild members chunk event
updatePresence(shardId, options):Promise<void>
Updates the presence of the bot user
NameTypeOptionalDescription
shardIdnumberNoThe id of the shard to update the presence in
optionsGatewayPresenceUpdateDataNoThe options for updating the presence
updateVoiceState(options):Promise<void>
NameTypeOptionalDescription
optionsGatewayVoiceStateUpdateDataNoThe options for updating the voice state