Skip to content

Commit

Permalink
add set voice status
Browse files Browse the repository at this point in the history
  • Loading branch information
DonovanDMC committed Sep 4, 2023
1 parent 52366f9 commit fb65f1e
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 0 deletions.
13 changes: 13 additions & 0 deletions lib/routes/Channels.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1132,6 +1132,19 @@ export default class Channels {
});
}

/**
* Set a voice status in a channel.
* @param channelID The ID of the channel to set the voice status in.
* @param status The voice status to set.
*/
async setVoiceStatus(channelID: string, status: string | null): Promise<void> {
await this.#manager.authRequest<null>({
method: "PUT",
path: Routes.VOICE_STATUS(channelID),
json: { status }
});
}

/**
* Create a thread from an existing message.
* @param channelID The ID of the channel to create the thread in.
Expand Down
8 changes: 8 additions & 0 deletions lib/structures/VoiceChannel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,14 @@ export default class VoiceChannel extends TextableVoiceChannel<VoiceChannel> {
super.update(data);
}

/**
* Set a voice status in this channel.
* @param status The voice status to set.
*/
async setStatus(status: string | null): Promise<void> {
return this.client.rest.channels.setVoiceStatus(this.id, status);
}

override toJSON(): JSONVoiceChannel {
return {
...super.toJSON(),
Expand Down
1 change: 1 addition & 0 deletions lib/util/Routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export const CHANNEL_TYPING = (channelID: string) => `/
export const GROUP_RECIPIENT = (channelID: string, userID: string) => `/channels/${channelID}/recipients/${userID}` as const;
export const VOICE_REGIONS = "/voice/regions" as const;
export const GUILD_VOICE_REGIONS = (guildID: string) => `/guilds/${guildID}/regions` as const;
export const VOICE_STATUS = (channelID: string) => `/channels/${channelID}/voice-status` as const;

// OAuth
export const OAUTH_APPLICATION = "/oauth2/applications/@me" as const;
Expand Down

0 comments on commit fb65f1e

Please sign in to comment.