From c61fc8082a11659bb0af29058aa7d840196295f0 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Thu, 23 Jun 2022 13:51:42 +0100 Subject: [PATCH] fix(VoiceChannel): NSFW property (v13) (#8161) Co-authored-by: Rodry <38259440+ImRodry@users.noreply.github.com> Co-authored-by: pat <73502164+nyapat@users.noreply.github.com> --- src/structures/VoiceChannel.js | 10 ++++++++++ typings/index.d.ts | 1 + 2 files changed, 11 insertions(+) diff --git a/src/structures/VoiceChannel.js b/src/structures/VoiceChannel.js index bd5a07a0b37b..c09fc81de62e 100644 --- a/src/structures/VoiceChannel.js +++ b/src/structures/VoiceChannel.js @@ -24,6 +24,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); } @@ -59,6 +65,10 @@ class VoiceChannel extends BaseGuildVoiceChannel { */ this.rateLimitPerUser = data.rate_limit_per_user; } + + if ('nsfw' in data) { + this.nsfw = data.nsfw; + } } /** diff --git a/typings/index.d.ts b/typings/index.d.ts index 992cd8180bd2..2cc0936dfeac 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -2660,6 +2660,7 @@ export class VoiceChannel extends TextBasedChannelMixin(BaseGuildVoiceChannel, [ public readonly editable: boolean; public readonly speakable: boolean; public type: 'GUILD_VOICE'; + public nsfw: boolean; public rateLimitPerUser: number | null; public setBitrate(bitrate: number, reason?: string): Promise; public setUserLimit(userLimit: number, reason?: string): Promise;