From e031a8d4def5bfc22fad5af0aa056365c5d2fdcd Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Fri, 28 Aug 2026 10:53:15 +0100 Subject: [PATCH] feat: Obfuscation (#1718) * feat: obfuscation * docs: sync obfuscation documentation --- deno/gateway/v10.ts | 21 +++++++++++++++++++++ deno/gateway/v9.ts | 21 +++++++++++++++++++++ deno/payloads/v10/channel.ts | 6 ++++++ deno/payloads/v9/channel.ts | 6 ++++++ gateway/v10.ts | 21 +++++++++++++++++++++ gateway/v9.ts | 21 +++++++++++++++++++++ payloads/v10/channel.ts | 6 ++++++ payloads/v9/channel.ts | 6 ++++++ 8 files changed, 108 insertions(+) diff --git a/deno/gateway/v10.ts b/deno/gateway/v10.ts index 96fe051c..7589b41c 100644 --- a/deno/gateway/v10.ts +++ b/deno/gateway/v10.ts @@ -232,6 +232,20 @@ export enum GatewayIntentBits { DirectMessagePolls = 1 << 25, } +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#identify-gateway-capabilities} + */ +export enum GatewayCapabilityBits { + /** + * Opts the client into receiving {@link https://docs.discord.com/developers/resources/channel#channel-object-obfuscated-channels | obfuscated channel metadata} over the Gateway for channels it can't view + * + * @unstable `CHANNEL_OBFUSCATION` is a temporary, testing-only opt-in for channel obfuscation. This opt-in mechanism + * will change before the feature reaches general availability. Obfuscation is then planned to apply to all bots + * automatically, even when they don't provide this capability. + */ + ChannelObfuscation = 1 << 15, +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#receive-events} */ @@ -2528,6 +2542,13 @@ export interface GatewayIdentifyData { * @see {@link https://discord.com/developers/docs/topics/gateway#gateway-intents} */ intents: number; + /** + * Bitfield representing {@link https://docs.discord.com/developers/events/gateway-events#identify-gateway-capabilities | capabilities} of your gateway client + * + * @defaultValue `0` + * @see {@link https://docs.discord.com/developers/events/gateway-events#identify-gateway-capabilities} + */ + capabilities?: number; } /** diff --git a/deno/gateway/v9.ts b/deno/gateway/v9.ts index eb52e4f2..9b4b4a59 100644 --- a/deno/gateway/v9.ts +++ b/deno/gateway/v9.ts @@ -231,6 +231,20 @@ export enum GatewayIntentBits { DirectMessagePolls = 1 << 25, } +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#identify-gateway-capabilities} + */ +export enum GatewayCapabilityBits { + /** + * Opts the client into receiving {@link https://docs.discord.com/developers/resources/channel#channel-object-obfuscated-channels | obfuscated channel metadata} over the Gateway for channels it can't view + * + * @unstable `CHANNEL_OBFUSCATION` is a temporary, testing-only opt-in for channel obfuscation. This opt-in mechanism + * will change before the feature reaches general availability. Obfuscation is then planned to apply to all bots + * automatically, even when they don't provide this capability. + */ + ChannelObfuscation = 1 << 15, +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#receive-events} */ @@ -2527,6 +2541,13 @@ export interface GatewayIdentifyData { * @see {@link https://discord.com/developers/docs/topics/gateway#gateway-intents} */ intents: number; + /** + * Bitfield representing {@link https://docs.discord.com/developers/events/gateway-events#identify-gateway-capabilities | capabilities} of your gateway client + * + * @defaultValue `0` + * @see {@link https://docs.discord.com/developers/events/gateway-events#identify-gateway-capabilities} + */ + capabilities?: number; } /** diff --git a/deno/payloads/v10/channel.ts b/deno/payloads/v10/channel.ts index 1b01f15b..b4b1747f 100644 --- a/deno/payloads/v10/channel.ts +++ b/deno/payloads/v10/channel.ts @@ -723,6 +723,12 @@ export enum ChannelFlags { * Whether media download options are hidden. */ HideMediaDownloadOptions = 1 << 15, + /** + * This channel's metadata has been obfuscated because the current user cannot view it. Only ever set on channels + * received over the {@link https://docs.discord.com/developers/events/gateway | Gateway}; the HTTP API never sets this flag. See + * {@link https://docs.discord.com/developers/resources/channel#channel-object-obfuscated-channels | Obfuscated Channels}. + */ + ChannelObfuscated = 1 << 17, /** * This channel is a Spoiler Channel i.e. users must opt in to view its contents. */ diff --git a/deno/payloads/v9/channel.ts b/deno/payloads/v9/channel.ts index 859bf9b6..e7cbc611 100644 --- a/deno/payloads/v9/channel.ts +++ b/deno/payloads/v9/channel.ts @@ -725,6 +725,12 @@ export enum ChannelFlags { * Whether media download options are hidden. */ HideMediaDownloadOptions = 1 << 15, + /** + * This channel's metadata has been obfuscated because the current user cannot view it. Only ever set on channels + * received over the {@link https://docs.discord.com/developers/events/gateway | Gateway}; the HTTP API never sets this flag. See + * {@link https://docs.discord.com/developers/resources/channel#channel-object-obfuscated-channels | Obfuscated Channels}. + */ + ChannelObfuscated = 1 << 17, /** * This channel is a Spoiler Channel i.e. users must opt in to view its contents. */ diff --git a/gateway/v10.ts b/gateway/v10.ts index 6fbf3866..d04f1066 100644 --- a/gateway/v10.ts +++ b/gateway/v10.ts @@ -232,6 +232,20 @@ export enum GatewayIntentBits { DirectMessagePolls = 1 << 25, } +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#identify-gateway-capabilities} + */ +export enum GatewayCapabilityBits { + /** + * Opts the client into receiving {@link https://docs.discord.com/developers/resources/channel#channel-object-obfuscated-channels | obfuscated channel metadata} over the Gateway for channels it can't view + * + * @unstable `CHANNEL_OBFUSCATION` is a temporary, testing-only opt-in for channel obfuscation. This opt-in mechanism + * will change before the feature reaches general availability. Obfuscation is then planned to apply to all bots + * automatically, even when they don't provide this capability. + */ + ChannelObfuscation = 1 << 15, +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#receive-events} */ @@ -2528,6 +2542,13 @@ export interface GatewayIdentifyData { * @see {@link https://discord.com/developers/docs/topics/gateway#gateway-intents} */ intents: number; + /** + * Bitfield representing {@link https://docs.discord.com/developers/events/gateway-events#identify-gateway-capabilities | capabilities} of your gateway client + * + * @defaultValue `0` + * @see {@link https://docs.discord.com/developers/events/gateway-events#identify-gateway-capabilities} + */ + capabilities?: number; } /** diff --git a/gateway/v9.ts b/gateway/v9.ts index c46b1c3e..a705a542 100644 --- a/gateway/v9.ts +++ b/gateway/v9.ts @@ -231,6 +231,20 @@ export enum GatewayIntentBits { DirectMessagePolls = 1 << 25, } +/** + * @see {@link https://docs.discord.com/developers/events/gateway-events#identify-gateway-capabilities} + */ +export enum GatewayCapabilityBits { + /** + * Opts the client into receiving {@link https://docs.discord.com/developers/resources/channel#channel-object-obfuscated-channels | obfuscated channel metadata} over the Gateway for channels it can't view + * + * @unstable `CHANNEL_OBFUSCATION` is a temporary, testing-only opt-in for channel obfuscation. This opt-in mechanism + * will change before the feature reaches general availability. Obfuscation is then planned to apply to all bots + * automatically, even when they don't provide this capability. + */ + ChannelObfuscation = 1 << 15, +} + /** * @see {@link https://discord.com/developers/docs/topics/gateway-events#receive-events} */ @@ -2527,6 +2541,13 @@ export interface GatewayIdentifyData { * @see {@link https://discord.com/developers/docs/topics/gateway#gateway-intents} */ intents: number; + /** + * Bitfield representing {@link https://docs.discord.com/developers/events/gateway-events#identify-gateway-capabilities | capabilities} of your gateway client + * + * @defaultValue `0` + * @see {@link https://docs.discord.com/developers/events/gateway-events#identify-gateway-capabilities} + */ + capabilities?: number; } /** diff --git a/payloads/v10/channel.ts b/payloads/v10/channel.ts index 0067a5fe..78478a5b 100644 --- a/payloads/v10/channel.ts +++ b/payloads/v10/channel.ts @@ -723,6 +723,12 @@ export enum ChannelFlags { * Whether media download options are hidden. */ HideMediaDownloadOptions = 1 << 15, + /** + * This channel's metadata has been obfuscated because the current user cannot view it. Only ever set on channels + * received over the {@link https://docs.discord.com/developers/events/gateway | Gateway}; the HTTP API never sets this flag. See + * {@link https://docs.discord.com/developers/resources/channel#channel-object-obfuscated-channels | Obfuscated Channels}. + */ + ChannelObfuscated = 1 << 17, /** * This channel is a Spoiler Channel i.e. users must opt in to view its contents. */ diff --git a/payloads/v9/channel.ts b/payloads/v9/channel.ts index 8d0fd13f..3b29d143 100644 --- a/payloads/v9/channel.ts +++ b/payloads/v9/channel.ts @@ -725,6 +725,12 @@ export enum ChannelFlags { * Whether media download options are hidden. */ HideMediaDownloadOptions = 1 << 15, + /** + * This channel's metadata has been obfuscated because the current user cannot view it. Only ever set on channels + * received over the {@link https://docs.discord.com/developers/events/gateway | Gateway}; the HTTP API never sets this flag. See + * {@link https://docs.discord.com/developers/resources/channel#channel-object-obfuscated-channels | Obfuscated Channels}. + */ + ChannelObfuscated = 1 << 17, /** * This channel is a Spoiler Channel i.e. users must opt in to view its contents. */