Skip to content

Commit

Permalink
feat: stage channels! (#107)
Browse files Browse the repository at this point in the history
  • Loading branch information
vladfrangu committed Apr 8, 2021
1 parent d8d7bcc commit 6cd7542
Show file tree
Hide file tree
Showing 11 changed files with 95 additions and 3 deletions.
8 changes: 7 additions & 1 deletion deno/v8/payloads/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export enum ChannelType {
/**
* A text channel within a guild
*/
GUILD_TEXT = 0,
GUILD_TEXT,
/**
* A direct message between users
*/
Expand Down Expand Up @@ -145,6 +145,12 @@ export enum ChannelType {
* See https://discord.com/developers/docs/game-and-server-management/special-channels
*/
GUILD_STORE,
/**
* A voice channel for hosting events with an audience
*
* See https://support.discord.com/hc/en-us/articles/1500005513722
*/
GUILD_STAGE_VOICE = 13,
}

export enum VideoQualityMode {
Expand Down
1 change: 1 addition & 0 deletions deno/v8/payloads/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const PermissionFlagsBits = {
MANAGE_WEBHOOKS: 1n << 29n,
MANAGE_EMOJIS: 1n << 30n,
USE_APPLICATION_COMMANDS: 1n << 31n,
REQUEST_TO_SPEAK: 1n << 32n,
} as const;

/**
Expand Down
4 changes: 4 additions & 0 deletions deno/v8/payloads/voice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export interface GatewayVoiceState {
* Whether this user is muted by the current user
*/
suppress: boolean;
/**
* The time at which the user requested to speak
*/
request_to_speak_timestamp: string | null;
}

/**
Expand Down
26 changes: 26 additions & 0 deletions deno/v8/rest/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,3 +770,29 @@ export interface RESTPatchAPIGuildMemberVerificationJSONBody {
}

export type RESTPatchAPIGuildMemberVerificationResult = APIGuildMembershipScreening;

export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
/**
* The id of the channel the user is currently in
*/
channel_id: Snowflake;
/**
* Toggles the user's suppress state
*/
suppress?: boolean;
/**
* Sets the user's request to speak
*/
request_to_speak_timestamp?: string | null;
}

export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
/**
* The id of the channel the user is currently in
*/
channel_id: Snowflake;
/**
* Toggles the user's suppress state
*/
suppress?: boolean;
}
9 changes: 9 additions & 0 deletions deno/v8/rest/mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,15 @@ export const Routes = {
guildMemberVerification(guildID: Snowflake) {
return `/guilds/${guildID}/member-verification` as const;
},

/**
* Route for:
* - PATCH `/guilds/{guild.id}/voice-states/@me`
* - PATCH `/guilds/{guild.id}/voice-states/{user.id}`
*/
guildVoiceState(guildID: Snowflake, userID: Snowflake | '@me' = '@me') {
return `/guilds/${guildID}/voice-states/${userID}` as const;
},
};

export const RouteBases = {
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
}
},
"lint-staged": {
"*.{mjs,js,ts}": "eslint --fix --ext mjs,js,ts"
"{v*,default,common}/**/*.{mjs,js,ts}": "eslint --fix --ext mjs,js,ts"
},
"commitlint": {
"extends": [
Expand Down
8 changes: 7 additions & 1 deletion v8/payloads/channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ export const enum ChannelType {
/**
* A text channel within a guild
*/
GUILD_TEXT = 0,
GUILD_TEXT,
/**
* A direct message between users
*/
Expand Down Expand Up @@ -145,6 +145,12 @@ export const enum ChannelType {
* See https://discord.com/developers/docs/game-and-server-management/special-channels
*/
GUILD_STORE,
/**
* A voice channel for hosting events with an audience
*
* See https://support.discord.com/hc/en-us/articles/1500005513722
*/
GUILD_STAGE_VOICE = 13,
}

export const enum VideoQualityMode {
Expand Down
1 change: 1 addition & 0 deletions v8/payloads/permissions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ export const PermissionFlagsBits = {
MANAGE_WEBHOOKS: 1n << 29n,
MANAGE_EMOJIS: 1n << 30n,
USE_APPLICATION_COMMANDS: 1n << 31n,
REQUEST_TO_SPEAK: 1n << 32n,
} as const;

/**
Expand Down
4 changes: 4 additions & 0 deletions v8/payloads/voice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ export interface GatewayVoiceState {
* Whether this user is muted by the current user
*/
suppress: boolean;
/**
* The time at which the user requested to speak
*/
request_to_speak_timestamp: string | null;
}

/**
Expand Down
26 changes: 26 additions & 0 deletions v8/rest/guild.ts
Original file line number Diff line number Diff line change
Expand Up @@ -770,3 +770,29 @@ export interface RESTPatchAPIGuildMemberVerificationJSONBody {
}

export type RESTPatchAPIGuildMemberVerificationResult = APIGuildMembershipScreening;

export interface RESTPatchAPIGuildVoiceStateCurrentMemberJSONBody {
/**
* The id of the channel the user is currently in
*/
channel_id: Snowflake;
/**
* Toggles the user's suppress state
*/
suppress?: boolean;
/**
* Sets the user's request to speak
*/
request_to_speak_timestamp?: string | null;
}

export interface RESTPatchAPIGuildVoiceStateUserJSONBody {
/**
* The id of the channel the user is currently in
*/
channel_id: Snowflake;
/**
* Toggles the user's suppress state
*/
suppress?: boolean;
}
9 changes: 9 additions & 0 deletions v8/rest/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,15 @@ export const Routes = {
guildMemberVerification(guildID: Snowflake) {
return `/guilds/${guildID}/member-verification` as const;
},

/**
* Route for:
* - PATCH `/guilds/{guild.id}/voice-states/@me`
* - PATCH `/guilds/{guild.id}/voice-states/{user.id}`
*/
guildVoiceState(guildID: Snowflake, userID: Snowflake | '@me' = '@me') {
return `/guilds/${guildID}/voice-states/${userID}` as const;
},
};

export const RouteBases = {
Expand Down

0 comments on commit 6cd7542

Please sign in to comment.