class Client
extends
AsyncEventEmitter<MappedEvents>export declare class Client extends AsyncEventEmitter<MappedEvents>
Constructors
{ rest, gateway }: ClientOptions)
constructor(Constructs a new instance of the Client
class
requestGuildMembersoptions: GatewayRequestGuildMembersDatatimeout?: number) : Promise<{ members: APIGuildMember[]; nonce: string; notFound: unknown[]; presences: GatewayGuildMembersChunkPresence[]; }> (
Requests guild members from the gateway.
const { members } = await client.requestGuildMembers({ guild_id: '1234567890', user_ids: ['9876543210'] });
See also: https://discord.com/developers/docs/topics/gateway-events#request-guild-members
requestGuildMembersIteratoroptions: GatewayRequestGuildMembersDatatimeout?: number) : 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.
for await (const { members } of client.requestGuildMembersIterator({ guild_id: '1234567890', query: '', limit: 0 })) {
console.log(members);
}
See also: https://discord.com/developers/docs/topics/gateway-events#request-guild-members
requestSoundboardSoundsoptions: GatewayRequestSoundboardSoundsDatatimeout?: number) : Promise<Map<string, APISoundboardSound[]>> (
Requests soundboard sounds from the gateway.
const soundboardSounds = await client.requestSoundboardSounds({ guild_ids: ['1234567890', '9876543210'], });
console.log(soundboardSounds.get('1234567890'));
See also: https://discord.com/developers/docs/topics/gateway-events#request-soundboard-sounds
requestSoundboardSoundsIteratoroptions: GatewayRequestSoundboardSoundsDatatimeout?: number) : 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.
for await (const { guildId, soundboardSounds } of this.requestSoundboardSoundsIterator({
guild_ids: ['1234567890', '9876543210'],
})) {
console.log(`Soundboard sounds for guild ${guildId}:`, soundboardSounds);
}
See also: https://discord.com/developers/docs/topics/gateway-events#request-soundboard-sounds
updatePresenceshardId: numberoptions: GatewayPresenceUpdateData) : Promise<void> (
Updates the presence of the bot user
updateVoiceStateoptions: GatewayVoiceStateUpdateData) : Promise<void> (
Updates the voice state of the bot user
See also: https://discord.com/developers/docs/topics/gateway-events#update-voice-state