Skip to content

Commit

Permalink
feat(Routes): voice state endpoint (#1046)
Browse files Browse the repository at this point in the history
  • Loading branch information
imnaiyar authored Aug 16, 2024
1 parent a85521a commit 1b1a865
Show file tree
Hide file tree
Showing 20 changed files with 268 additions and 188 deletions.
6 changes: 3 additions & 3 deletions deno/gateway/v10.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import type {
GatewayPresenceUpdate as RawGatewayPresenceUpdate,
GatewayThreadListSync as RawGatewayThreadListSync,
GatewayThreadMembersUpdate as RawGatewayThreadMembersUpdate,
GatewayVoiceState,
APIVoiceState,
InviteTargetType,
PresenceUpdateStatus,
AutoModerationRuleTriggerType,
Expand Down Expand Up @@ -785,7 +785,7 @@ export interface GatewayGuildCreateDispatchData extends APIGuild {
*
* See https://discord.com/developers/docs/resources/voice#voice-state-object
*/
voice_states: Omit<GatewayVoiceState, 'guild_id'>[];
voice_states: Omit<APIVoiceState, 'guild_id'>[];
/**
* Users in the guild
*
Expand Down Expand Up @@ -1748,7 +1748,7 @@ export type GatewayVoiceStateUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway-events#voice-state-update
*/
export type GatewayVoiceStateUpdateDispatchData = GatewayVoiceState;
export type GatewayVoiceStateUpdateDispatchData = APIVoiceState;

/**
* https://discord.com/developers/docs/topics/gateway-events#voice-server-update
Expand Down
6 changes: 3 additions & 3 deletions deno/gateway/v9.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import type {
GatewayPresenceUpdate as RawGatewayPresenceUpdate,
GatewayThreadListSync as RawGatewayThreadListSync,
GatewayThreadMembersUpdate as RawGatewayThreadMembersUpdate,
GatewayVoiceState,
APIVoiceState,
InviteTargetType,
PresenceUpdateStatus,
AutoModerationRuleTriggerType,
Expand Down Expand Up @@ -784,7 +784,7 @@ export interface GatewayGuildCreateDispatchData extends APIGuild {
*
* See https://discord.com/developers/docs/resources/voice#voice-state-object
*/
voice_states: Omit<GatewayVoiceState, 'guild_id'>[];
voice_states: Omit<APIVoiceState, 'guild_id'>[];
/**
* Users in the guild
*
Expand Down Expand Up @@ -1747,7 +1747,7 @@ export type GatewayVoiceStateUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway-events#voice-state-update
*/
export type GatewayVoiceStateUpdateDispatchData = GatewayVoiceState;
export type GatewayVoiceStateUpdateDispatchData = APIVoiceState;

/**
* https://discord.com/developers/docs/topics/gateway-events#voice-server-update
Expand Down
9 changes: 8 additions & 1 deletion deno/payloads/v10/voice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ import type { APIGuildMember } from './guild.ts';

/**
* https://discord.com/developers/docs/resources/voice#voice-state-object
*
* @deprecated This is deprecated, use {@apilink APIVoiceState}
*/
export interface GatewayVoiceState {
export type GatewayVoiceState = APIVoiceState;

/**
* https://discord.com/developers/docs/resources/voice#voice-state-object
*/
export interface APIVoiceState {
/**
* The guild id this voice state is for
*/
Expand Down
9 changes: 8 additions & 1 deletion deno/payloads/v9/voice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,15 @@ import type { APIGuildMember } from './guild.ts';

/**
* https://discord.com/developers/docs/resources/voice#voice-state-object
*
* @deprecated This is deprecated, use {@apilink APIVoiceState}
*/
export interface GatewayVoiceState {
export type GatewayVoiceState = APIVoiceState;

/**
* https://discord.com/developers/docs/resources/voice#voice-state-object
*/
export interface APIVoiceState {
/**
* The guild id this voice state is for
*/
Expand Down
42 changes: 0 additions & 42 deletions deno/rest/v10/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -896,48 +896,6 @@ export interface RESTPatchAPIGuildMemberVerificationJSONBody {

export type RESTPatchAPIGuildMemberVerificationResult = APIGuildMembershipScreening;

/**
* https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state
*/
export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
/**
* The id of the channel the user is currently in
*/
channel_id?: Snowflake | undefined;
/**
* Toggles the user's suppress state
*/
suppress?: boolean | undefined;
/**
* Sets the user's request to speak
*/
request_to_speak_timestamp?: string | null | undefined;
}

/**
* https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state
*/
export type RESTPatchAPIGuildVoiceStateCurrentMemberResult = never;

/**
* https://discord.com/developers/docs/resources/guild#modify-user-voice-state
*/
export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
/**
* The id of the channel the user is currently in
*/
channel_id: Snowflake;
/**
* Toggles the user's suppress state
*/
suppress?: boolean | undefined;
}

/**
* https://discord.com/developers/docs/resources/guild#modify-user-voice-state
*/
export type RESTPatchAPIGuildVoiceStateUserResult = never;

/**
* https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen
*/
Expand Down
2 changes: 2 additions & 0 deletions deno/rest/v10/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -788,6 +788,8 @@ export const Routes = {

/**
* Route for:
* - GET `/guilds/{guild.id}/voice-states/@me`
* - GET `/guilds/{guild.id}/voice-states/{user.id}`
* - PATCH `/guilds/{guild.id}/voice-states/@me`
* - PATCH `/guilds/{guild.id}/voice-states/{user.id}`
*/
Expand Down
55 changes: 54 additions & 1 deletion deno/rest/v10/voice.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { APIVoiceRegion } from '../../payloads/v10/mod.ts';
import type { Snowflake } from '../../globals.ts';
import type { APIVoiceRegion, APIVoiceState } from '../../payloads/v10/mod.ts';

/**
* https://discord.com/developers/docs/resources/voice#list-voice-regions
Expand All @@ -9,3 +10,55 @@ export type RESTGetAPIVoiceRegionsResult = APIVoiceRegion[];
* @deprecated This was exported with the wrong name, use `RESTGetAPIVoiceRegionsResult` instead
*/
export type GetAPIVoiceRegionsResult = RESTGetAPIVoiceRegionsResult;

/**
* https://discord.com/developers/docs/resources/voice#get-current-user-voice-state
*/
export type RESTGetAPIGuildVoiceStateCurrentMemberResult = APIVoiceState;

/**
* https://discord.com/developers/docs/resources/voice#get-user-voice-state
*/
export type RESTGetAPIGuildVoiceStateUserResult = APIVoiceState;

/**
* https://discord.com/developers/docs/resources/voice#modify-current-user-voice-state
*/
export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
/**
* The id of the channel the user is currently in
*/
channel_id?: Snowflake | undefined;
/**
* Toggles the user's suppress state
*/
suppress?: boolean | undefined;
/**
* Sets the user's request to speak
*/
request_to_speak_timestamp?: string | null | undefined;
}

/**
* https://discord.com/developers/docs/resources/voice#modify-current-user-voice-state
*/
export type RESTPatchAPIGuildVoiceStateCurrentMemberResult = never;

/**
* https://discord.com/developers/docs/resources/voice#modify-user-voice-state
*/
export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
/**
* The id of the channel the user is currently in
*/
channel_id: Snowflake;
/**
* Toggles the user's suppress state
*/
suppress?: boolean | undefined;
}

/**
* https://discord.com/developers/docs/resources/voice#modify-user-voice-state
*/
export type RESTPatchAPIGuildVoiceStateUserResult = never;
42 changes: 0 additions & 42 deletions deno/rest/v9/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -902,48 +902,6 @@ export interface RESTPatchAPIGuildMemberVerificationJSONBody {

export type RESTPatchAPIGuildMemberVerificationResult = APIGuildMembershipScreening;

/**
* https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state
*/
export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
/**
* The id of the channel the user is currently in
*/
channel_id?: Snowflake | undefined;
/**
* Toggles the user's suppress state
*/
suppress?: boolean | undefined;
/**
* Sets the user's request to speak
*/
request_to_speak_timestamp?: string | null | undefined;
}

/**
* https://discord.com/developers/docs/resources/guild#modify-current-user-voice-state
*/
export type RESTPatchAPIGuildVoiceStateCurrentMemberResult = never;

/**
* https://discord.com/developers/docs/resources/guild#modify-user-voice-state
*/
export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
/**
* The id of the channel the user is currently in
*/
channel_id: Snowflake;
/**
* Toggles the user's suppress state
*/
suppress?: boolean | undefined;
}

/**
* https://discord.com/developers/docs/resources/guild#modify-user-voice-state
*/
export type RESTPatchAPIGuildVoiceStateUserResult = never;

/**
* https://discord.com/developers/docs/resources/guild#get-guild-welcome-screen
*/
Expand Down
2 changes: 2 additions & 0 deletions deno/rest/v9/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -797,6 +797,8 @@ export const Routes = {

/**
* Route for:
* - GET `/guilds/{guild.id}/voice-states/@me`
* - GET `/guilds/{guild.id}/voice-states/{user.id}`
* - PATCH `/guilds/{guild.id}/voice-states/@me`
* - PATCH `/guilds/{guild.id}/voice-states/{user.id}`
*/
Expand Down
55 changes: 54 additions & 1 deletion deno/rest/v9/voice.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import type { APIVoiceRegion } from '../../payloads/v9/mod.ts';
import type { Snowflake } from '../../globals.ts';
import type { APIVoiceRegion, APIVoiceState } from '../../payloads/v9/mod.ts';

/**
* https://discord.com/developers/docs/resources/voice#list-voice-regions
Expand All @@ -9,3 +10,55 @@ export type RESTGetAPIVoiceRegionsResult = APIVoiceRegion[];
* @deprecated This was exported with the wrong name, use `RESTGetAPIVoiceRegionsResult` instead
*/
export type GetAPIVoiceRegionsResult = RESTGetAPIVoiceRegionsResult;

/**
* https://discord.com/developers/docs/resources/voice#get-current-user-voice-state
*/
export type RESTGetAPIGuildVoiceStateCurrentMemberResult = APIVoiceState;

/**
* https://discord.com/developers/docs/resources/voice#get-user-voice-state
*/
export type RESTGetAPIGuildVoiceStateUserResult = APIVoiceState;

/**
* https://discord.com/developers/docs/resources/voice#modify-current-user-voice-state
*/
export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
/**
* The id of the channel the user is currently in
*/
channel_id?: Snowflake | undefined;
/**
* Toggles the user's suppress state
*/
suppress?: boolean | undefined;
/**
* Sets the user's request to speak
*/
request_to_speak_timestamp?: string | null | undefined;
}

/**
* https://discord.com/developers/docs/resources/voice#modify-current-user-voice-state
*/
export type RESTPatchAPIGuildVoiceStateCurrentMemberResult = never;

/**
* https://discord.com/developers/docs/resources/voice#modify-user-voice-state
*/
export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
/**
* The id of the channel the user is currently in
*/
channel_id: Snowflake;
/**
* Toggles the user's suppress state
*/
suppress?: boolean | undefined;
}

/**
* https://discord.com/developers/docs/resources/voice#modify-user-voice-state
*/
export type RESTPatchAPIGuildVoiceStateUserResult = never;
6 changes: 3 additions & 3 deletions gateway/v10.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import type {
GatewayPresenceUpdate as RawGatewayPresenceUpdate,
GatewayThreadListSync as RawGatewayThreadListSync,
GatewayThreadMembersUpdate as RawGatewayThreadMembersUpdate,
GatewayVoiceState,
APIVoiceState,
InviteTargetType,
PresenceUpdateStatus,
AutoModerationRuleTriggerType,
Expand Down Expand Up @@ -785,7 +785,7 @@ export interface GatewayGuildCreateDispatchData extends APIGuild {
*
* See https://discord.com/developers/docs/resources/voice#voice-state-object
*/
voice_states: Omit<GatewayVoiceState, 'guild_id'>[];
voice_states: Omit<APIVoiceState, 'guild_id'>[];
/**
* Users in the guild
*
Expand Down Expand Up @@ -1748,7 +1748,7 @@ export type GatewayVoiceStateUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway-events#voice-state-update
*/
export type GatewayVoiceStateUpdateDispatchData = GatewayVoiceState;
export type GatewayVoiceStateUpdateDispatchData = APIVoiceState;

/**
* https://discord.com/developers/docs/topics/gateway-events#voice-server-update
Expand Down
6 changes: 3 additions & 3 deletions gateway/v9.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import type {
GatewayPresenceUpdate as RawGatewayPresenceUpdate,
GatewayThreadListSync as RawGatewayThreadListSync,
GatewayThreadMembersUpdate as RawGatewayThreadMembersUpdate,
GatewayVoiceState,
APIVoiceState,
InviteTargetType,
PresenceUpdateStatus,
AutoModerationRuleTriggerType,
Expand Down Expand Up @@ -784,7 +784,7 @@ export interface GatewayGuildCreateDispatchData extends APIGuild {
*
* See https://discord.com/developers/docs/resources/voice#voice-state-object
*/
voice_states: Omit<GatewayVoiceState, 'guild_id'>[];
voice_states: Omit<APIVoiceState, 'guild_id'>[];
/**
* Users in the guild
*
Expand Down Expand Up @@ -1747,7 +1747,7 @@ export type GatewayVoiceStateUpdateDispatch = DataPayload<
/**
* https://discord.com/developers/docs/topics/gateway-events#voice-state-update
*/
export type GatewayVoiceStateUpdateDispatchData = GatewayVoiceState;
export type GatewayVoiceStateUpdateDispatchData = APIVoiceState;

/**
* https://discord.com/developers/docs/topics/gateway-events#voice-server-update
Expand Down
Loading

0 comments on commit 1b1a865

Please sign in to comment.