feat (VoiceState) add setStatus function
This commit is contained in:
parent
a34e442e09
commit
b65545ad81
@ -214,6 +214,23 @@ class VoiceState extends Base {
|
|||||||
return this.guild.members.edit(this.id, { channel }, reason);
|
return this.guild.members.edit(this.id, { channel }, reason);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sets the status of the voice channel
|
||||||
|
* @param {string} status The message to set the channel status to
|
||||||
|
* @returns {Promise<void>}
|
||||||
|
*/
|
||||||
|
async setStatus(status) {
|
||||||
|
if (this.channel?.id) {
|
||||||
|
if (this.channel?.type !== 'GUILD_VOICE') throw new Error('VOICE_NOT_GUILD_CHANNEL');
|
||||||
|
|
||||||
|
await this.client.api.channels(this.channel.id, 'voice-status').put({
|
||||||
|
data: {
|
||||||
|
status,
|
||||||
|
},
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggles the request to speak in the channel.
|
* Toggles the request to speak in the channel.
|
||||||
* Only applicable for stage channels and for the client's own voice state.
|
* Only applicable for stage channels and for the client's own voice state.
|
||||||
|
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@ -3434,6 +3434,7 @@ export class VoiceState extends Base {
|
|||||||
public setMute(mute?: boolean, reason?: string): Promise<GuildMember>;
|
public setMute(mute?: boolean, reason?: string): Promise<GuildMember>;
|
||||||
public disconnect(reason?: string): Promise<GuildMember>;
|
public disconnect(reason?: string): Promise<GuildMember>;
|
||||||
public setChannel(channel: GuildVoiceChannelResolvable | null, reason?: string): Promise<GuildMember>;
|
public setChannel(channel: GuildVoiceChannelResolvable | null, reason?: string): Promise<GuildMember>;
|
||||||
|
public setStatus(status: string): Promise<void>;
|
||||||
public setRequestToSpeak(request?: boolean): Promise<void>;
|
public setRequestToSpeak(request?: boolean): Promise<void>;
|
||||||
public setSuppressed(suppressed?: boolean): Promise<void>;
|
public setSuppressed(suppressed?: boolean): Promise<void>;
|
||||||
public getPreview(): Promise<string>;
|
public getPreview(): Promise<string>;
|
||||||
|
Loading…
Reference in New Issue
Block a user