From f2ad0762c521422ab64e5b10344a6fd67961031b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Aura=20Rom=C3=A1n?= Date: Tue, 2 May 2023 12:32:47 +0200 Subject: [PATCH] refactor(GuildChannel): simplify constructor (#9499) --- packages/discord.js/src/structures/GuildChannel.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/packages/discord.js/src/structures/GuildChannel.js b/packages/discord.js/src/structures/GuildChannel.js index ab9e5c90bfd6..6de224a3f0f2 100644 --- a/packages/discord.js/src/structures/GuildChannel.js +++ b/packages/discord.js/src/structures/GuildChannel.js @@ -20,7 +20,7 @@ const PermissionsBitField = require('../util/PermissionsBitField'); */ class GuildChannel extends BaseChannel { constructor(guild, data, client, immediatePatch = true) { - super(guild?.client ?? client, data, false); + super(client, data, false); /** * The guild the channel is in @@ -33,8 +33,6 @@ class GuildChannel extends BaseChannel { * @type {Snowflake} */ this.guildId = guild?.id ?? data.guild_id; - - this.parentId = this.parentId ?? null; /** * A manager of permission overwrites that belong to this channel * @type {PermissionOverwriteManager} @@ -73,6 +71,8 @@ class GuildChannel extends BaseChannel { * @type {?Snowflake} */ this.parentId = data.parent_id; + } else { + this.parentId ??= null; } if ('permission_overwrites' in data) {