From 2eeaad6f27fdf8868364fa95ed20755ee09bda87 Mon Sep 17 00:00:00 2001 From: pat <73502164+nyapat@users.noreply.github.com> Date: Tue, 21 Jun 2022 07:35:42 -0500 Subject: [PATCH] fix(vcs): nsfw property (#8132) --- packages/discord.js/src/structures/VoiceChannel.js | 10 ++++++++++ packages/discord.js/typings/index.d.ts | 1 + 2 files changed, 11 insertions(+) diff --git a/packages/discord.js/src/structures/VoiceChannel.js b/packages/discord.js/src/structures/VoiceChannel.js index df8268b34..e85cef2f1 100644 --- a/packages/discord.js/src/structures/VoiceChannel.js +++ b/packages/discord.js/src/structures/VoiceChannel.js @@ -20,6 +20,12 @@ class VoiceChannel extends BaseGuildVoiceChannel { */ this.messages = new MessageManager(this); + /** + * If the guild considers this channel NSFW + * @type {boolean} + */ + this.nsfw = Boolean(data.nsfw); + this._patch(data); } @@ -55,6 +61,10 @@ class VoiceChannel extends BaseGuildVoiceChannel { */ this.rateLimitPerUser = data.rate_limit_per_user; } + + if ('nsfw' in data) { + this.nsfw = Boolean(data.nsfw); + } } /** diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 7789bd559..7fd47174d 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -2716,6 +2716,7 @@ export class VoiceChannel extends TextBasedChannelMixin(BaseGuildVoiceChannel, [ public videoQualityMode: VideoQualityMode | null; public get speakable(): boolean; public type: ChannelType.GuildVoice; + public nsfw: boolean; public rateLimitPerUser: number | null; public setBitrate(bitrate: number, reason?: string): Promise; public setUserLimit(userLimit: number, reason?: string): Promise;