mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-18 20:43:30 +01:00
refactor(GuildChannel): simplify constructor (#9499)
This commit is contained in:
@@ -20,7 +20,7 @@ const PermissionsBitField = require('../util/PermissionsBitField');
|
|||||||
*/
|
*/
|
||||||
class GuildChannel extends BaseChannel {
|
class GuildChannel extends BaseChannel {
|
||||||
constructor(guild, data, client, immediatePatch = true) {
|
constructor(guild, data, client, immediatePatch = true) {
|
||||||
super(guild?.client ?? client, data, false);
|
super(client, data, false);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* The guild the channel is in
|
* The guild the channel is in
|
||||||
@@ -33,8 +33,6 @@ class GuildChannel extends BaseChannel {
|
|||||||
* @type {Snowflake}
|
* @type {Snowflake}
|
||||||
*/
|
*/
|
||||||
this.guildId = guild?.id ?? data.guild_id;
|
this.guildId = guild?.id ?? data.guild_id;
|
||||||
|
|
||||||
this.parentId = this.parentId ?? null;
|
|
||||||
/**
|
/**
|
||||||
* A manager of permission overwrites that belong to this channel
|
* A manager of permission overwrites that belong to this channel
|
||||||
* @type {PermissionOverwriteManager}
|
* @type {PermissionOverwriteManager}
|
||||||
@@ -73,6 +71,8 @@ class GuildChannel extends BaseChannel {
|
|||||||
* @type {?Snowflake}
|
* @type {?Snowflake}
|
||||||
*/
|
*/
|
||||||
this.parentId = data.parent_id;
|
this.parentId = data.parent_id;
|
||||||
|
} else {
|
||||||
|
this.parentId ??= null;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ('permission_overwrites' in data) {
|
if ('permission_overwrites' in data) {
|
||||||
|
|||||||
Reference in New Issue
Block a user