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
optionsGatewayRequestGuildMembersDataNo
The options for the request
timeoutnumberYes
The 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
optionsGatewayRequestGuildMembersDataNo
The options for the request
timeoutnumberYes
The timeout for waiting for each guild members chunk event
requestSoundboardSounds(options, timeout?):Promise<Map<string, APISoundboardSound[]>>
Requests soundboard sounds from the gateway.
Example
Requesting soundboard sounds for specific guilds
const soundboardSounds = await client.requestSoundboardSounds({ guild_ids: ['1234567890', '9876543210'], });

console.log(soundboardSounds.get('1234567890'));
const soundboardSounds = await client.requestSoundboardSounds({ guild_ids: ['1234567890', '9876543210'], });

console.log(soundboardSounds.get('1234567890'));
NameTypeOptionalDescription
optionsGatewayRequestSoundboardSoundsDataNo
The options for the request
timeoutnumberYes
The timeout for waiting for each soundboard sounds event
requestSoundboardSoundsIterator(options, timeout?):AsyncGenerator<{ guildId: string; soundboardSounds: APISoundboardSound[]; }, void, unknown>
Requests soundboard sounds from the gateway and returns an async iterator that yields the data from each soundboard sounds event.
Example
Requesting soundboard sounds for specific guilds
for await (const { guildId, soundboardSounds } of this.requestSoundboardSoundsIterator({
guild_ids: ['1234567890', '9876543210'],
})) {
console.log(`Soundboard sounds for guild ${guildId}:`, soundboardSounds);
}
for await (const { guildId, soundboardSounds } of this.requestSoundboardSoundsIterator({
guild_ids: ['1234567890', '9876543210'],
})) {
console.log(`Soundboard sounds for guild ${guildId}:`, soundboardSounds);
}
NameTypeOptionalDescription
optionsGatewayRequestSoundboardSoundsDataNo
The options for the request
timeoutnumberYes
The timeout for waiting for each soundboard sounds
updatePresence(shardId, options):Promise<void>
Updates the presence of the bot user
NameTypeOptionalDescription
shardIdnumberNo
The id of the shard to update the presence in
optionsGatewayPresenceUpdateDataNo
The options for updating the presence
updateVoiceState(options):Promise<void>
NameTypeOptionalDescription
optionsGatewayVoiceStateUpdateDataNo
The options for updating the voice state