From 7d3339b894e1bcb167406b82638bc1a0227ed15f Mon Sep 17 00:00:00 2001 From: Kshitij Anurag <230598819+kshitijanurag@users.noreply.github.com> Date: Tue, 16 Jun 2026 16:25:06 +0530 Subject: [PATCH] feat: voice channel status (#1631) * feat: voice channel status * chore: update docs links --------- Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com> Co-authored-by: Almeida --- deno/gateway/v10.ts | 130 ++++++++++++++++++++++++++++++++++ deno/gateway/v9.ts | 130 ++++++++++++++++++++++++++++++++++ deno/payloads/common.ts | 6 ++ deno/payloads/v10/auditLog.ts | 11 +++ deno/payloads/v9/auditLog.ts | 11 +++ deno/rest/v10/channel.ts | 15 ++++ deno/rest/v10/mod.ts | 8 +++ deno/rest/v9/channel.ts | 15 ++++ deno/rest/v9/mod.ts | 8 +++ gateway/v10.ts | 130 ++++++++++++++++++++++++++++++++++ gateway/v9.ts | 130 ++++++++++++++++++++++++++++++++++ payloads/common.ts | 6 ++ payloads/v10/auditLog.ts | 11 +++ payloads/v9/auditLog.ts | 11 +++ rest/v10/channel.ts | 15 ++++ rest/v10/index.ts | 8 +++ rest/v9/channel.ts | 15 ++++ rest/v9/index.ts | 8 +++ 18 files changed, 668 insertions(+) diff --git a/deno/gateway/v10.ts b/deno/gateway/v10.ts index 2e828f52..b980e445 100644 --- a/deno/gateway/v10.ts +++ b/deno/gateway/v10.ts @@ -109,6 +109,10 @@ export enum GatewayOpcodes { * Request information about soundboard sounds in a set of guilds */ RequestSoundboardSounds = 31, + /** + * Request ephemeral channel data for channels in a guild. + */ + RequestChannelInfo = 43, } /** @@ -239,6 +243,7 @@ export enum GatewayDispatchEvents { AutoModerationRuleUpdate = 'AUTO_MODERATION_RULE_UPDATE', ChannelCreate = 'CHANNEL_CREATE', ChannelDelete = 'CHANNEL_DELETE', + ChannelInfo = 'CHANNEL_INFO', ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE', ChannelUpdate = 'CHANNEL_UPDATE', EntitlementCreate = 'ENTITLEMENT_CREATE', @@ -305,6 +310,8 @@ export enum GatewayDispatchEvents { TypingStart = 'TYPING_START', UserUpdate = 'USER_UPDATE', VoiceChannelEffectSend = 'VOICE_CHANNEL_EFFECT_SEND', + VoiceChannelStartTimeUpdate = 'VOICE_CHANNEL_START_TIME_UPDATE', + VoiceChannelStatusUpdate = 'VOICE_CHANNEL_STATUS_UPDATE', VoiceServerUpdate = 'VOICE_SERVER_UPDATE', VoiceStateUpdate = 'VOICE_STATE_UPDATE', WebhooksUpdate = 'WEBHOOKS_UPDATE', @@ -313,6 +320,7 @@ export enum GatewayDispatchEvents { export type GatewaySendPayload = | GatewayHeartbeat | GatewayIdentify + | GatewayRequestChannelInfo | GatewayRequestGuildMembers | GatewayRequestSoundboardSounds | GatewayResume @@ -335,6 +343,7 @@ export type GatewayDispatchPayload = | GatewayAutoModerationRuleUpdateDispatch | GatewayChannelCreateDispatch | GatewayChannelDeleteDispatch + | GatewayChannelInfoDispatch | GatewayChannelPinsUpdateDispatch | GatewayChannelUpdateDispatch | GatewayEntitlementCreateDispatch @@ -401,6 +410,8 @@ export type GatewayDispatchPayload = | GatewayTypingStartDispatch | GatewayUserUpdateDispatch | GatewayVoiceChannelEffectSendDispatch + | GatewayVoiceChannelStartTimeUpdateDispatch + | GatewayVoiceChannelStatusUpdateDispatch | GatewayVoiceServerUpdateDispatch | GatewayVoiceStateUpdateDispatch | GatewayWebhooksUpdateDispatch; @@ -787,6 +798,46 @@ export type GatewayChannelDeleteDispatch = _DataPayload< */ export type GatewayChannelDeleteDispatchData = GatewayChannelModifyDispatchData; +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#channel-info} + */ +export type GatewayChannelInfoDispatch = _DataPayload< + GatewayDispatchEvents.ChannelInfo, + GatewayChannelInfoDispatchData +>; + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#channel-info} + */ +export interface GatewayChannelInfoDispatchData { + /** + * The guild id + */ + guild_id: Snowflake; + /** + * Ephemeral data for channels in the guild + */ + channels: GatewayChannelInfoChannel[]; +} + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#channel-info-channel-info-channel-structure} + */ +export interface GatewayChannelInfoChannel { + /** + * The channel id + */ + id: Snowflake; + /** + * The voice channel status + */ + status?: string | null; + /** + * Unix timestamp (in seconds) of when the voice session started + */ + voice_start_time?: number | null; +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#channel-pins-update} */ @@ -2162,6 +2213,58 @@ export enum VoiceChannelEffectSendAnimationType { Basic, } +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-status-update} + */ +export type GatewayVoiceChannelStatusUpdateDispatch = _DataPayload< + GatewayDispatchEvents.VoiceChannelStatusUpdate, + GatewayVoiceChannelStatusUpdateDispatchData +>; + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-status-update} + */ +export interface GatewayVoiceChannelStatusUpdateDispatchData { + /** + * The channel id + */ + id: Snowflake; + /** + * The guild id + */ + guild_id: Snowflake; + /** + * The new voice channel status + */ + status: string | null; +} + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-start-time-update} + */ +export type GatewayVoiceChannelStartTimeUpdateDispatch = _DataPayload< + GatewayDispatchEvents.VoiceChannelStartTimeUpdate, + GatewayVoiceChannelStartTimeUpdateDispatchData +>; + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-start-time-update} + */ +export interface GatewayVoiceChannelStartTimeUpdateDispatchData { + /** + * The channel id + */ + id: Snowflake; + /** + * The guild id + */ + guild_id: Snowflake; + /** + * Unix timestamp (in seconds) of when the voice session started + */ + voice_start_time?: number | null; +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#voice-state-update} */ @@ -2551,6 +2654,33 @@ export interface GatewayRequestSoundboardSoundsData { guild_ids: Snowflake[]; } +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#request-channel-info} + */ +export interface GatewayRequestChannelInfo { + op: GatewayOpcodes.RequestChannelInfo; + d: GatewayRequestChannelInfoData; +} + +export enum GatewayRequestChannelInfoField { + Status = 'status', + VoiceStartTime = 'voice_start_time', +} + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#request-channel-info} + */ +export interface GatewayRequestChannelInfoData { + /** + * The guild id to request channel info for + */ + guild_id: Snowflake; + /** + * The fields to request. The current available fields are `status` and `voice_start_time` + */ + fields: (GatewayRequestChannelInfoField | (string & {}))[]; +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#update-voice-state} */ diff --git a/deno/gateway/v9.ts b/deno/gateway/v9.ts index afe4a4f3..5bc55dea 100644 --- a/deno/gateway/v9.ts +++ b/deno/gateway/v9.ts @@ -109,6 +109,10 @@ export enum GatewayOpcodes { * Request information about soundboard sounds in a set of guilds */ RequestSoundboardSounds = 31, + /** + * Request ephemeral channel data for channels in a guild. + */ + RequestChannelInfo = 43, } /** @@ -238,6 +242,7 @@ export enum GatewayDispatchEvents { AutoModerationRuleUpdate = 'AUTO_MODERATION_RULE_UPDATE', ChannelCreate = 'CHANNEL_CREATE', ChannelDelete = 'CHANNEL_DELETE', + ChannelInfo = 'CHANNEL_INFO', ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE', ChannelUpdate = 'CHANNEL_UPDATE', EntitlementCreate = 'ENTITLEMENT_CREATE', @@ -304,6 +309,8 @@ export enum GatewayDispatchEvents { TypingStart = 'TYPING_START', UserUpdate = 'USER_UPDATE', VoiceChannelEffectSend = 'VOICE_CHANNEL_EFFECT_SEND', + VoiceChannelStartTimeUpdate = 'VOICE_CHANNEL_START_TIME_UPDATE', + VoiceChannelStatusUpdate = 'VOICE_CHANNEL_STATUS_UPDATE', VoiceServerUpdate = 'VOICE_SERVER_UPDATE', VoiceStateUpdate = 'VOICE_STATE_UPDATE', WebhooksUpdate = 'WEBHOOKS_UPDATE', @@ -312,6 +319,7 @@ export enum GatewayDispatchEvents { export type GatewaySendPayload = | GatewayHeartbeat | GatewayIdentify + | GatewayRequestChannelInfo | GatewayRequestGuildMembers | GatewayRequestSoundboardSounds | GatewayResume @@ -334,6 +342,7 @@ export type GatewayDispatchPayload = | GatewayAutoModerationRuleUpdateDispatch | GatewayChannelCreateDispatch | GatewayChannelDeleteDispatch + | GatewayChannelInfoDispatch | GatewayChannelPinsUpdateDispatch | GatewayChannelUpdateDispatch | GatewayEntitlementCreateDispatch @@ -400,6 +409,8 @@ export type GatewayDispatchPayload = | GatewayTypingStartDispatch | GatewayUserUpdateDispatch | GatewayVoiceChannelEffectSendDispatch + | GatewayVoiceChannelStartTimeUpdateDispatch + | GatewayVoiceChannelStatusUpdateDispatch | GatewayVoiceServerUpdateDispatch | GatewayVoiceStateUpdateDispatch | GatewayWebhooksUpdateDispatch; @@ -786,6 +797,46 @@ export type GatewayChannelDeleteDispatch = _DataPayload< */ export type GatewayChannelDeleteDispatchData = GatewayChannelModifyDispatchData; +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#channel-info} + */ +export type GatewayChannelInfoDispatch = _DataPayload< + GatewayDispatchEvents.ChannelInfo, + GatewayChannelInfoDispatchData +>; + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#channel-info} + */ +export interface GatewayChannelInfoDispatchData { + /** + * The guild id + */ + guild_id: Snowflake; + /** + * Ephemeral data for channels in the guild + */ + channels: GatewayChannelInfoChannel[]; +} + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#channel-info-channel-info-channel-structure} + */ +export interface GatewayChannelInfoChannel { + /** + * The channel id + */ + id: Snowflake; + /** + * The voice channel status + */ + status?: string | null; + /** + * Unix timestamp (in seconds) of when the voice session started + */ + voice_start_time?: number | null; +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#channel-pins-update} */ @@ -2161,6 +2212,58 @@ export enum VoiceChannelEffectSendAnimationType { Basic, } +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-status-update} + */ +export type GatewayVoiceChannelStatusUpdateDispatch = _DataPayload< + GatewayDispatchEvents.VoiceChannelStatusUpdate, + GatewayVoiceChannelStatusUpdateDispatchData +>; + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-status-update} + */ +export interface GatewayVoiceChannelStatusUpdateDispatchData { + /** + * The channel id + */ + id: Snowflake; + /** + * The guild id + */ + guild_id: Snowflake; + /** + * The new voice channel status + */ + status: string | null; +} + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-start-time-update} + */ +export type GatewayVoiceChannelStartTimeUpdateDispatch = _DataPayload< + GatewayDispatchEvents.VoiceChannelStartTimeUpdate, + GatewayVoiceChannelStartTimeUpdateDispatchData +>; + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-start-time-update} + */ +export interface GatewayVoiceChannelStartTimeUpdateDispatchData { + /** + * The channel id + */ + id: Snowflake; + /** + * The guild id + */ + guild_id: Snowflake; + /** + * Unix timestamp (in seconds) of when the voice session started + */ + voice_start_time?: number | null; +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#voice-state-update} */ @@ -2550,6 +2653,33 @@ export interface GatewayRequestSoundboardSoundsData { guild_ids: Snowflake[]; } +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#request-channel-info} + */ +export interface GatewayRequestChannelInfo { + op: GatewayOpcodes.RequestChannelInfo; + d: GatewayRequestChannelInfoData; +} + +export enum GatewayRequestChannelInfoField { + Status = 'status', + VoiceStartTime = 'voice_start_time', +} + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#request-channel-info} + */ +export interface GatewayRequestChannelInfoData { + /** + * The guild id to request channel info for + */ + guild_id: Snowflake; + /** + * The fields to request. The current available fields are `status` and `voice_start_time` + */ + fields: (GatewayRequestChannelInfoField | (string & {}))[]; +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#update-voice-state} */ diff --git a/deno/payloads/common.ts b/deno/payloads/common.ts index f2b84f82..0d30efc2 100644 --- a/deno/payloads/common.ts +++ b/deno/payloads/common.ts @@ -275,6 +275,12 @@ export const PermissionFlagsBits = { * Applies to channel types: Text, Voice, Stage */ SendVoiceMessages: 1n << 46n, + /** + * Allows setting voice channel status + * + * Applies to channel types: Voice + */ + SetVoiceChannelStatus: 1n << 48n, /** * Allows sending polls * diff --git a/deno/payloads/v10/auditLog.ts b/deno/payloads/v10/auditLog.ts index fdd56204..8574ae00 100644 --- a/deno/payloads/v10/auditLog.ts +++ b/deno/payloads/v10/auditLog.ts @@ -226,6 +226,8 @@ export enum AuditLogEvent { HomeSettingsCreate = 190, HomeSettingsUpdate, + VoiceChannelStatusCreate, + VoiceChannelStatusDelete, } /** @@ -282,6 +284,8 @@ export interface APIAuditLogOptions { * - AUTO_MODERATION_FLAG_TO_CHANNEL * - AUTO_MODERATION_USER_COMMUNICATION_DISABLED * - AUTO_MODERATION_QUARANTINE_USER + * - VOICE_CHANNEL_STATUS_CREATE + * - VOICE_CHANNEL_STATUS_DELETE */ channel_id?: Snowflake; @@ -354,6 +358,13 @@ export interface APIAuditLogOptions { * - APPLICATION_COMMAND_PERMISSION_UPDATE */ application_id?: Snowflake; + /** + * The new voice channel status + * + * Present from: + * - VOICE_CHANNEL_STATUS_CREATE + */ + status?: string; } export enum AuditLogOptionsType { diff --git a/deno/payloads/v9/auditLog.ts b/deno/payloads/v9/auditLog.ts index fdd56204..8574ae00 100644 --- a/deno/payloads/v9/auditLog.ts +++ b/deno/payloads/v9/auditLog.ts @@ -226,6 +226,8 @@ export enum AuditLogEvent { HomeSettingsCreate = 190, HomeSettingsUpdate, + VoiceChannelStatusCreate, + VoiceChannelStatusDelete, } /** @@ -282,6 +284,8 @@ export interface APIAuditLogOptions { * - AUTO_MODERATION_FLAG_TO_CHANNEL * - AUTO_MODERATION_USER_COMMUNICATION_DISABLED * - AUTO_MODERATION_QUARANTINE_USER + * - VOICE_CHANNEL_STATUS_CREATE + * - VOICE_CHANNEL_STATUS_DELETE */ channel_id?: Snowflake; @@ -354,6 +358,13 @@ export interface APIAuditLogOptions { * - APPLICATION_COMMAND_PERMISSION_UPDATE */ application_id?: Snowflake; + /** + * The new voice channel status + * + * Present from: + * - VOICE_CHANNEL_STATUS_CREATE + */ + status?: string; } export enum AuditLogOptionsType { diff --git a/deno/rest/v10/channel.ts b/deno/rest/v10/channel.ts index 17b62054..005e6662 100644 --- a/deno/rest/v10/channel.ts +++ b/deno/rest/v10/channel.ts @@ -897,3 +897,18 @@ export interface RESTGetAPIChannelUsersThreadsArchivedResult extends APIThreadLi */ has_more: boolean; } + +/** + * @see {@link https://docs.discord.com/developers/resources/channel#set-voice-channel-status} + */ +export interface RESTPutAPIChannelVoiceStatusJSONBody { + /** + * New voice channel status (up to 500 characters) + */ + status: string | null; +} + +/** + * @see {@link https://docs.discord.com/developers/resources/channel#set-voice-channel-status} + */ +export type RESTPutAPIChannelVoiceStatusResult = undefined; diff --git a/deno/rest/v10/mod.ts b/deno/rest/v10/mod.ts index 5fd15d7f..6be7c617 100644 --- a/deno/rest/v10/mod.ts +++ b/deno/rest/v10/mod.ts @@ -228,6 +228,14 @@ export const Routes = { return `/channels/${channelId}/recipients/${userId}` as const; }, + /** + * Route for: + * - PUT `/channels/{channel.id}/voice-status` + */ + channelVoiceStatus(channelId: Snowflake) { + return `/channels/${channelId}/voice-status` as const; + }, + /** * Route for: * - GET `/guilds/{guild.id}/emojis` diff --git a/deno/rest/v9/channel.ts b/deno/rest/v9/channel.ts index a61d2333..53edad96 100644 --- a/deno/rest/v9/channel.ts +++ b/deno/rest/v9/channel.ts @@ -911,3 +911,18 @@ export type RESTGetAPIChannelThreadsResult = APIThreadList; * @see {@link https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads} */ export type RESTGetAPIChannelUsersThreadsArchivedResult = APIThreadList; + +/** + * @see {@link https://docs.discord.com/developers/resources/channel#set-voice-channel-status} + */ +export interface RESTPutAPIChannelVoiceStatusJSONBody { + /** + * New voice channel status (up to 500 characters) + */ + status: string | null; +} + +/** + * @see {@link https://docs.discord.com/developers/resources/channel#set-voice-channel-status} + */ +export type RESTPutAPIChannelVoiceStatusResult = undefined; diff --git a/deno/rest/v9/mod.ts b/deno/rest/v9/mod.ts index de61fcc7..6372c1f9 100644 --- a/deno/rest/v9/mod.ts +++ b/deno/rest/v9/mod.ts @@ -228,6 +228,14 @@ export const Routes = { return `/channels/${channelId}/recipients/${userId}` as const; }, + /** + * Route for: + * - PUT `/channels/{channel.id}/voice-status` + */ + channelVoiceStatus(channelId: Snowflake) { + return `/channels/${channelId}/voice-status` as const; + }, + /** * Route for: * - GET `/guilds/{guild.id}/emojis` diff --git a/gateway/v10.ts b/gateway/v10.ts index ba1d5457..37c98302 100644 --- a/gateway/v10.ts +++ b/gateway/v10.ts @@ -109,6 +109,10 @@ export enum GatewayOpcodes { * Request information about soundboard sounds in a set of guilds */ RequestSoundboardSounds = 31, + /** + * Request ephemeral channel data for channels in a guild. + */ + RequestChannelInfo = 43, } /** @@ -239,6 +243,7 @@ export enum GatewayDispatchEvents { AutoModerationRuleUpdate = 'AUTO_MODERATION_RULE_UPDATE', ChannelCreate = 'CHANNEL_CREATE', ChannelDelete = 'CHANNEL_DELETE', + ChannelInfo = 'CHANNEL_INFO', ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE', ChannelUpdate = 'CHANNEL_UPDATE', EntitlementCreate = 'ENTITLEMENT_CREATE', @@ -305,6 +310,8 @@ export enum GatewayDispatchEvents { TypingStart = 'TYPING_START', UserUpdate = 'USER_UPDATE', VoiceChannelEffectSend = 'VOICE_CHANNEL_EFFECT_SEND', + VoiceChannelStartTimeUpdate = 'VOICE_CHANNEL_START_TIME_UPDATE', + VoiceChannelStatusUpdate = 'VOICE_CHANNEL_STATUS_UPDATE', VoiceServerUpdate = 'VOICE_SERVER_UPDATE', VoiceStateUpdate = 'VOICE_STATE_UPDATE', WebhooksUpdate = 'WEBHOOKS_UPDATE', @@ -313,6 +320,7 @@ export enum GatewayDispatchEvents { export type GatewaySendPayload = | GatewayHeartbeat | GatewayIdentify + | GatewayRequestChannelInfo | GatewayRequestGuildMembers | GatewayRequestSoundboardSounds | GatewayResume @@ -335,6 +343,7 @@ export type GatewayDispatchPayload = | GatewayAutoModerationRuleUpdateDispatch | GatewayChannelCreateDispatch | GatewayChannelDeleteDispatch + | GatewayChannelInfoDispatch | GatewayChannelPinsUpdateDispatch | GatewayChannelUpdateDispatch | GatewayEntitlementCreateDispatch @@ -401,6 +410,8 @@ export type GatewayDispatchPayload = | GatewayTypingStartDispatch | GatewayUserUpdateDispatch | GatewayVoiceChannelEffectSendDispatch + | GatewayVoiceChannelStartTimeUpdateDispatch + | GatewayVoiceChannelStatusUpdateDispatch | GatewayVoiceServerUpdateDispatch | GatewayVoiceStateUpdateDispatch | GatewayWebhooksUpdateDispatch; @@ -787,6 +798,46 @@ export type GatewayChannelDeleteDispatch = _DataPayload< */ export type GatewayChannelDeleteDispatchData = GatewayChannelModifyDispatchData; +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#channel-info} + */ +export type GatewayChannelInfoDispatch = _DataPayload< + GatewayDispatchEvents.ChannelInfo, + GatewayChannelInfoDispatchData +>; + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#channel-info} + */ +export interface GatewayChannelInfoDispatchData { + /** + * The guild id + */ + guild_id: Snowflake; + /** + * Ephemeral data for channels in the guild + */ + channels: GatewayChannelInfoChannel[]; +} + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#channel-info-channel-info-channel-structure} + */ +export interface GatewayChannelInfoChannel { + /** + * The channel id + */ + id: Snowflake; + /** + * The voice channel status + */ + status?: string | null; + /** + * Unix timestamp (in seconds) of when the voice session started + */ + voice_start_time?: number | null; +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#channel-pins-update} */ @@ -2162,6 +2213,58 @@ export enum VoiceChannelEffectSendAnimationType { Basic, } +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-status-update} + */ +export type GatewayVoiceChannelStatusUpdateDispatch = _DataPayload< + GatewayDispatchEvents.VoiceChannelStatusUpdate, + GatewayVoiceChannelStatusUpdateDispatchData +>; + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-status-update} + */ +export interface GatewayVoiceChannelStatusUpdateDispatchData { + /** + * The channel id + */ + id: Snowflake; + /** + * The guild id + */ + guild_id: Snowflake; + /** + * The new voice channel status + */ + status: string | null; +} + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-start-time-update} + */ +export type GatewayVoiceChannelStartTimeUpdateDispatch = _DataPayload< + GatewayDispatchEvents.VoiceChannelStartTimeUpdate, + GatewayVoiceChannelStartTimeUpdateDispatchData +>; + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-start-time-update} + */ +export interface GatewayVoiceChannelStartTimeUpdateDispatchData { + /** + * The channel id + */ + id: Snowflake; + /** + * The guild id + */ + guild_id: Snowflake; + /** + * Unix timestamp (in seconds) of when the voice session started + */ + voice_start_time?: number | null; +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#voice-state-update} */ @@ -2551,6 +2654,33 @@ export interface GatewayRequestSoundboardSoundsData { guild_ids: Snowflake[]; } +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#request-channel-info} + */ +export interface GatewayRequestChannelInfo { + op: GatewayOpcodes.RequestChannelInfo; + d: GatewayRequestChannelInfoData; +} + +export enum GatewayRequestChannelInfoField { + Status = 'status', + VoiceStartTime = 'voice_start_time', +} + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#request-channel-info} + */ +export interface GatewayRequestChannelInfoData { + /** + * The guild id to request channel info for + */ + guild_id: Snowflake; + /** + * The fields to request. The current available fields are `status` and `voice_start_time` + */ + fields: (GatewayRequestChannelInfoField | (string & {}))[]; +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#update-voice-state} */ diff --git a/gateway/v9.ts b/gateway/v9.ts index 60797dc5..c0edf6d1 100644 --- a/gateway/v9.ts +++ b/gateway/v9.ts @@ -109,6 +109,10 @@ export enum GatewayOpcodes { * Request information about soundboard sounds in a set of guilds */ RequestSoundboardSounds = 31, + /** + * Request ephemeral channel data for channels in a guild. + */ + RequestChannelInfo = 43, } /** @@ -238,6 +242,7 @@ export enum GatewayDispatchEvents { AutoModerationRuleUpdate = 'AUTO_MODERATION_RULE_UPDATE', ChannelCreate = 'CHANNEL_CREATE', ChannelDelete = 'CHANNEL_DELETE', + ChannelInfo = 'CHANNEL_INFO', ChannelPinsUpdate = 'CHANNEL_PINS_UPDATE', ChannelUpdate = 'CHANNEL_UPDATE', EntitlementCreate = 'ENTITLEMENT_CREATE', @@ -304,6 +309,8 @@ export enum GatewayDispatchEvents { TypingStart = 'TYPING_START', UserUpdate = 'USER_UPDATE', VoiceChannelEffectSend = 'VOICE_CHANNEL_EFFECT_SEND', + VoiceChannelStartTimeUpdate = 'VOICE_CHANNEL_START_TIME_UPDATE', + VoiceChannelStatusUpdate = 'VOICE_CHANNEL_STATUS_UPDATE', VoiceServerUpdate = 'VOICE_SERVER_UPDATE', VoiceStateUpdate = 'VOICE_STATE_UPDATE', WebhooksUpdate = 'WEBHOOKS_UPDATE', @@ -312,6 +319,7 @@ export enum GatewayDispatchEvents { export type GatewaySendPayload = | GatewayHeartbeat | GatewayIdentify + | GatewayRequestChannelInfo | GatewayRequestGuildMembers | GatewayRequestSoundboardSounds | GatewayResume @@ -334,6 +342,7 @@ export type GatewayDispatchPayload = | GatewayAutoModerationRuleUpdateDispatch | GatewayChannelCreateDispatch | GatewayChannelDeleteDispatch + | GatewayChannelInfoDispatch | GatewayChannelPinsUpdateDispatch | GatewayChannelUpdateDispatch | GatewayEntitlementCreateDispatch @@ -400,6 +409,8 @@ export type GatewayDispatchPayload = | GatewayTypingStartDispatch | GatewayUserUpdateDispatch | GatewayVoiceChannelEffectSendDispatch + | GatewayVoiceChannelStartTimeUpdateDispatch + | GatewayVoiceChannelStatusUpdateDispatch | GatewayVoiceServerUpdateDispatch | GatewayVoiceStateUpdateDispatch | GatewayWebhooksUpdateDispatch; @@ -786,6 +797,46 @@ export type GatewayChannelDeleteDispatch = _DataPayload< */ export type GatewayChannelDeleteDispatchData = GatewayChannelModifyDispatchData; +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#channel-info} + */ +export type GatewayChannelInfoDispatch = _DataPayload< + GatewayDispatchEvents.ChannelInfo, + GatewayChannelInfoDispatchData +>; + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#channel-info} + */ +export interface GatewayChannelInfoDispatchData { + /** + * The guild id + */ + guild_id: Snowflake; + /** + * Ephemeral data for channels in the guild + */ + channels: GatewayChannelInfoChannel[]; +} + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#channel-info-channel-info-channel-structure} + */ +export interface GatewayChannelInfoChannel { + /** + * The channel id + */ + id: Snowflake; + /** + * The voice channel status + */ + status?: string | null; + /** + * Unix timestamp (in seconds) of when the voice session started + */ + voice_start_time?: number | null; +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#channel-pins-update} */ @@ -2161,6 +2212,58 @@ export enum VoiceChannelEffectSendAnimationType { Basic, } +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-status-update} + */ +export type GatewayVoiceChannelStatusUpdateDispatch = _DataPayload< + GatewayDispatchEvents.VoiceChannelStatusUpdate, + GatewayVoiceChannelStatusUpdateDispatchData +>; + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-status-update} + */ +export interface GatewayVoiceChannelStatusUpdateDispatchData { + /** + * The channel id + */ + id: Snowflake; + /** + * The guild id + */ + guild_id: Snowflake; + /** + * The new voice channel status + */ + status: string | null; +} + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-start-time-update} + */ +export type GatewayVoiceChannelStartTimeUpdateDispatch = _DataPayload< + GatewayDispatchEvents.VoiceChannelStartTimeUpdate, + GatewayVoiceChannelStartTimeUpdateDispatchData +>; + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#voice-channel-start-time-update} + */ +export interface GatewayVoiceChannelStartTimeUpdateDispatchData { + /** + * The channel id + */ + id: Snowflake; + /** + * The guild id + */ + guild_id: Snowflake; + /** + * Unix timestamp (in seconds) of when the voice session started + */ + voice_start_time?: number | null; +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#voice-state-update} */ @@ -2550,6 +2653,33 @@ export interface GatewayRequestSoundboardSoundsData { guild_ids: Snowflake[]; } +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#request-channel-info} + */ +export interface GatewayRequestChannelInfo { + op: GatewayOpcodes.RequestChannelInfo; + d: GatewayRequestChannelInfoData; +} + +export enum GatewayRequestChannelInfoField { + Status = 'status', + VoiceStartTime = 'voice_start_time', +} + +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#request-channel-info} + */ +export interface GatewayRequestChannelInfoData { + /** + * The guild id to request channel info for + */ + guild_id: Snowflake; + /** + * The fields to request. The current available fields are `status` and `voice_start_time` + */ + fields: (GatewayRequestChannelInfoField | (string & {}))[]; +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#update-voice-state} */ diff --git a/payloads/common.ts b/payloads/common.ts index acb537eb..cf6a524d 100644 --- a/payloads/common.ts +++ b/payloads/common.ts @@ -275,6 +275,12 @@ export const PermissionFlagsBits = { * Applies to channel types: Text, Voice, Stage */ SendVoiceMessages: 1n << 46n, + /** + * Allows setting voice channel status + * + * Applies to channel types: Voice + */ + SetVoiceChannelStatus: 1n << 48n, /** * Allows sending polls * diff --git a/payloads/v10/auditLog.ts b/payloads/v10/auditLog.ts index 3f4faae4..45814a17 100644 --- a/payloads/v10/auditLog.ts +++ b/payloads/v10/auditLog.ts @@ -226,6 +226,8 @@ export enum AuditLogEvent { HomeSettingsCreate = 190, HomeSettingsUpdate, + VoiceChannelStatusCreate, + VoiceChannelStatusDelete, } /** @@ -282,6 +284,8 @@ export interface APIAuditLogOptions { * - AUTO_MODERATION_FLAG_TO_CHANNEL * - AUTO_MODERATION_USER_COMMUNICATION_DISABLED * - AUTO_MODERATION_QUARANTINE_USER + * - VOICE_CHANNEL_STATUS_CREATE + * - VOICE_CHANNEL_STATUS_DELETE */ channel_id?: Snowflake; @@ -354,6 +358,13 @@ export interface APIAuditLogOptions { * - APPLICATION_COMMAND_PERMISSION_UPDATE */ application_id?: Snowflake; + /** + * The new voice channel status + * + * Present from: + * - VOICE_CHANNEL_STATUS_CREATE + */ + status?: string; } export enum AuditLogOptionsType { diff --git a/payloads/v9/auditLog.ts b/payloads/v9/auditLog.ts index 3f4faae4..45814a17 100644 --- a/payloads/v9/auditLog.ts +++ b/payloads/v9/auditLog.ts @@ -226,6 +226,8 @@ export enum AuditLogEvent { HomeSettingsCreate = 190, HomeSettingsUpdate, + VoiceChannelStatusCreate, + VoiceChannelStatusDelete, } /** @@ -282,6 +284,8 @@ export interface APIAuditLogOptions { * - AUTO_MODERATION_FLAG_TO_CHANNEL * - AUTO_MODERATION_USER_COMMUNICATION_DISABLED * - AUTO_MODERATION_QUARANTINE_USER + * - VOICE_CHANNEL_STATUS_CREATE + * - VOICE_CHANNEL_STATUS_DELETE */ channel_id?: Snowflake; @@ -354,6 +358,13 @@ export interface APIAuditLogOptions { * - APPLICATION_COMMAND_PERMISSION_UPDATE */ application_id?: Snowflake; + /** + * The new voice channel status + * + * Present from: + * - VOICE_CHANNEL_STATUS_CREATE + */ + status?: string; } export enum AuditLogOptionsType { diff --git a/rest/v10/channel.ts b/rest/v10/channel.ts index 824a444c..9601c9ed 100644 --- a/rest/v10/channel.ts +++ b/rest/v10/channel.ts @@ -897,3 +897,18 @@ export interface RESTGetAPIChannelUsersThreadsArchivedResult extends APIThreadLi */ has_more: boolean; } + +/** + * @see {@link https://docs.discord.com/developers/resources/channel#set-voice-channel-status} + */ +export interface RESTPutAPIChannelVoiceStatusJSONBody { + /** + * New voice channel status (up to 500 characters) + */ + status: string | null; +} + +/** + * @see {@link https://docs.discord.com/developers/resources/channel#set-voice-channel-status} + */ +export type RESTPutAPIChannelVoiceStatusResult = undefined; diff --git a/rest/v10/index.ts b/rest/v10/index.ts index 5ba1072f..f6353043 100644 --- a/rest/v10/index.ts +++ b/rest/v10/index.ts @@ -228,6 +228,14 @@ export const Routes = { return `/channels/${channelId}/recipients/${userId}` as const; }, + /** + * Route for: + * - PUT `/channels/{channel.id}/voice-status` + */ + channelVoiceStatus(channelId: Snowflake) { + return `/channels/${channelId}/voice-status` as const; + }, + /** * Route for: * - GET `/guilds/{guild.id}/emojis` diff --git a/rest/v9/channel.ts b/rest/v9/channel.ts index 7041453b..6d197e1e 100644 --- a/rest/v9/channel.ts +++ b/rest/v9/channel.ts @@ -911,3 +911,18 @@ export type RESTGetAPIChannelThreadsResult = APIThreadList; * @see {@link https://discord.com/developers/docs/resources/channel#list-joined-private-archived-threads} */ export type RESTGetAPIChannelUsersThreadsArchivedResult = APIThreadList; + +/** + * @see {@link https://docs.discord.com/developers/resources/channel#set-voice-channel-status} + */ +export interface RESTPutAPIChannelVoiceStatusJSONBody { + /** + * New voice channel status (up to 500 characters) + */ + status: string | null; +} + +/** + * @see {@link https://docs.discord.com/developers/resources/channel#set-voice-channel-status} + */ +export type RESTPutAPIChannelVoiceStatusResult = undefined; diff --git a/rest/v9/index.ts b/rest/v9/index.ts index 7be6250d..be4e8ea0 100644 --- a/rest/v9/index.ts +++ b/rest/v9/index.ts @@ -228,6 +228,14 @@ export const Routes = { return `/channels/${channelId}/recipients/${userId}` as const; }, + /** + * Route for: + * - PUT `/channels/{channel.id}/voice-status` + */ + channelVoiceStatus(channelId: Snowflake) { + return `/channels/${channelId}/voice-status` as const; + }, + /** * Route for: * - GET `/guilds/{guild.id}/emojis`