From 5a9422544469071c3f3b90fb79642168491b1311 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 b23ec50fba5f..968ae3230ada 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 6a806e3110b5..c947ee593384 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -2587,6 +2587,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;