From a89fc44873fd3c1bf8fada3490971e7c52e42abc Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Wed, 20 Nov 2019 20:59:42 -0600 Subject: [PATCH 01/18] Add Channel.from() --- lib/structures/Channel.js | 34 +++++++++++++++++++++++++++++++++- 1 file changed, 33 insertions(+), 1 deletion(-) diff --git a/lib/structures/Channel.js b/lib/structures/Channel.js index d858306af..f007e96af 100644 --- a/lib/structures/Channel.js +++ b/lib/structures/Channel.js @@ -3,7 +3,7 @@ const Base = require("./Base"); /** -* Represents a channel. You also probably want to look at CategoryChannel, GroupChannel, PrivateChannel, TextChannel, NewsChannel, and VoiceChannel. +* Represents a channel. You also probably want to look at CategoryChannel, GroupChannel, NewsChannel, PrivateChannel, TextChannel, and VoiceChannel. * @prop {String} id The ID of the channel * @prop {String} mention A string that mentions the channel * @prop {Number} type The type of the channel @@ -18,6 +18,30 @@ class Channel extends Base { get mention() { return `<#${this.id}>`; } + + static from(data, extra) { + switch(data.type) { + case 0: { + return new TextChannel(data, extra); + } + case 1: { + return new PrivateChannel(data, extra); + } + case 2: { + return new VoiceChannel(data, extra); + } + case 3: { + return new GroupChannel(data, extra); + } + case 4: { + return new CategoryChannel(data, extra); + } + case 5: { + return new NewsChannel(data, extra); + } + } + return new Channel(data); + } toJSON() { const base = super.toJSON(true); @@ -31,3 +55,11 @@ class Channel extends Base { } module.exports = Channel; + +// Circular import +const CategoryChannel = require("./CategoryChannel"); +const GroupChannel = require("./GroupChannel"); +const NewsChannel = require("./NewsChannel"); +const PrivateChannel = require("./PrivateChannel"); +const TextChannel = require("./TextChannel"); +const VoiceChannel = require("./VoiceChannel"); From 9a2733f5db35194d64c7b19eb4e7b9413ddfa473 Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Wed, 20 Nov 2019 21:16:50 -0600 Subject: [PATCH 02/18] Clear channel if statements --- lib/Client.js | 77 +++++---------------------------------------------- 1 file changed, 7 insertions(+), 70 deletions(-) diff --git a/lib/Client.js b/lib/Client.js index e454d100b..464df4ea1 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -1,27 +1,22 @@ "use strict"; -const CategoryChannel = require("./structures/CategoryChannel"); +const Channel = require("./structures/Channel"); const Collection = require("./util/Collection"); const Constants = require("./Constants"); const Endpoints = require("./rest/Endpoints"); const ExtendedUser = require("./structures/ExtendedUser"); -const GroupChannel = require("./structures/GroupChannel"); const Guild = require("./structures/Guild"); const GuildAuditLogEntry = require("./structures/GuildAuditLogEntry"); const GuildIntegration = require("./structures/GuildIntegration"); const Invite = require("./structures/Invite"); const Member = require("./structures/Member"); const Message = require("./structures/Message"); -const PrivateChannel = require("./structures/PrivateChannel"); const Relationship = require("./structures/Relationship"); const RequestHandler = require("./rest/RequestHandler"); const Role = require("./structures/Role"); const ShardManager = require("./gateway/ShardManager"); -const TextChannel = require("./structures/TextChannel"); -const NewsChannel = require("./structures/NewsChannel"); const UnavailableGuild = require("./structures/UnavailableGuild"); const User = require("./structures/User"); -const VoiceChannel = require("./structures/VoiceChannel"); const VoiceConnectionManager = require("./voice/VoiceConnectionManager"); let EventEmitter; @@ -417,19 +412,7 @@ class Client extends EventEmitter { rate_limit_per_user: options.rateLimitPerUser, parent_id: options.parentID, permission_overwrites: options.permissionOverwrites - }).then((channel) => { - if(channel.type === 2) { - return new VoiceChannel(channel, guild); - } else if(channel.type === 4) { - return new CategoryChannel(channel, guild); - } else if(channel.type === 5) { - return new NewsChannel(channel, guild); - } else if(channel.type === 0 || channel.last_message_id !== undefined) { - return new TextChannel(channel, guild); - } else { - return channel; - } - }); + }).then((channel) => Channel.from(channel, this.guilds.get(channel.guild_id) || this)); } /** @@ -460,27 +443,7 @@ class Client extends EventEmitter { rate_limit_per_user: options.rateLimitPerUser, parent_id: options.parentID, reason: reason - }).then((data) => { - if(data.guild_id) { - let guild = data.guild_id || this.channelGuildMap[channelID]; - if(guild) { - guild = this.guilds.get(guild); - } - if(data.type === 2) { - return new VoiceChannel(data, guild); - } else if(data.type === 4) { - return new CategoryChannel(data, guild); - } else if(data.type === 5) { - return new NewsChannel(data, guild); - } else if(data.type === 0 || (data.guild_id && data.last_message_id !== undefined)) { - return new TextChannel(data, guild); - } else { - return data; - } - } else { - return new GroupChannel(data, this); - } - }); + }).then((channel) => Channel.from(channel, this.guilds.get(channel.guild_id) || this)); } /** @@ -1855,23 +1818,8 @@ class Client extends EventEmitter { if(!this.options.restMode) { return Promise.reject(new Error("Eris REST mode is not enabled")); } - return this.requestHandler.request("GET", Endpoints.CHANNEL(channelID), true).then((channel) => { - if(channel.type === 1) { - return new PrivateChannel(channel, this); - } else if(channel.type === 2) { - return new VoiceChannel(channel, null); - } else if(channel.type === 3) { - return new GroupChannel(channel, this); - } else if(channel.type === 4) { - return new CategoryChannel(channel, null); - } else if(channel.type === 5) { - return new NewsChannel(channel, null, this.options.messageLimit); - } else if(channel.type === 0 || (channel.guild_id && channel.last_message_id !== undefined)) { - return new TextChannel(channel, null, this.options.messageLimit); - } else { - return channel; - } - }); + return this.requestHandler.request("GET", Endpoints.CHANNEL(channelID), true) + .then((channel) => Channel.from(channel, this.guilds.get(channel.guild_id) || this)); } /** @@ -1913,19 +1861,8 @@ class Client extends EventEmitter { if(!this.options.restMode) { return Promise.reject(new Error("Eris REST mode is not enabled")); } - return this.requestHandler.request("GET", Endpoints.GUILD_CHANNELS(guildID), true).then((channels) => channels.map((channel) => { - if(channel.type === 2) { - return new VoiceChannel(channel, null); - } else if(channel.type === 4) { - return new CategoryChannel(channel, null); - } else if(channel.type === 5) { - return new NewsChannel(channel, null, this.options.messageLimit); - } else if(channel.type === 0 || channel.last_message_id !== undefined) { - return new TextChannel(channel, null, this.options.messageLimit); - } else { - return channel; - } - })); + return this.requestHandler.request("GET", Endpoints.GUILD_CHANNELS(guildID), true) + .then((channels) => channels.map((channel) => Channel.from(channel, this))); } /** From e7116c0c7dda3d317a0358796c6736052ff92cdc Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Wed, 20 Nov 2019 21:22:30 -0600 Subject: [PATCH 03/18] Clear channel if statements from Guild --- lib/structures/Guild.js | 21 ++------------------- 1 file changed, 2 insertions(+), 19 deletions(-) diff --git a/lib/structures/Guild.js b/lib/structures/Guild.js index fffc98c7a..9d14c29da 100644 --- a/lib/structures/Guild.js +++ b/lib/structures/Guild.js @@ -1,16 +1,13 @@ "use strict"; const Base = require("./Base"); -const CategoryChannel = require("./CategoryChannel"); +const Channel = require("./Channel"); const {CDN_URL} = require("../rest/Endpoints"); const Constants = require("../Constants"); const Collection = require("../util/Collection"); const GuildChannel = require("./GuildChannel"); const Member = require("./Member"); const Role = require("./Role"); -const TextChannel = require("./TextChannel"); -const NewsChannel = require("./NewsChannel"); -const VoiceChannel = require("./VoiceChannel"); const VoiceState = require("./VoiceState"); /** @@ -70,21 +67,7 @@ class Guild extends Base { if(data.channels) { for(let channel of data.channels) { - if(channel.type === 2) { - channel = this.channels.add(new VoiceChannel(channel, this), this); - } else if(channel.type === 4) { - channel = this.channels.add(new CategoryChannel(channel, this), this); - } else if(channel.type === 5) { - channel = this.channels.add(new NewsChannel(channel, this), this); - } else if(channel.type === 0 || channel.last_message_id !== undefined) { - channel = this.channels.add(new TextChannel(channel, this), this); - } else { - channel = this.channels.add(channel, this); - } - if(channel.parentID && this.channels.get(channel.parentID)) { - this.channels.get(channel.parentID).channels.add(channel); - } - client.channelGuildMap[channel.id] = this.id; + this.channels.add(Channel.from(channel, client)); } } From a9d7e607ba697c1c99e537d11224a6475d4576b1 Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Wed, 20 Nov 2019 22:04:21 -0600 Subject: [PATCH 04/18] Fix linting problems for Client.js --- lib/Client.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/Client.js b/lib/Client.js index 464df4ea1..cc833cf5b 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -5,12 +5,14 @@ const Collection = require("./util/Collection"); const Constants = require("./Constants"); const Endpoints = require("./rest/Endpoints"); const ExtendedUser = require("./structures/ExtendedUser"); +const GroupChannel = require("./structures/GroupChannel"); const Guild = require("./structures/Guild"); const GuildAuditLogEntry = require("./structures/GuildAuditLogEntry"); const GuildIntegration = require("./structures/GuildIntegration"); const Invite = require("./structures/Invite"); const Member = require("./structures/Member"); const Message = require("./structures/Message"); +const PrivateChannel = require("./structures/PrivateChannel"); const Relationship = require("./structures/Relationship"); const RequestHandler = require("./rest/RequestHandler"); const Role = require("./structures/Role"); @@ -386,7 +388,6 @@ class Client extends EventEmitter { * @returns {Promise} */ createChannel(guildID, name, type, reason, options = {}) { - const guild = this.guilds.get(guildID); if(typeof options === "string") { // This used to be parentID, back-compat this.emit("warn", "[DEPRECATED] createChannel() was called with a string `options` argument"); options = { From e07d5cd1b0fe13da354037a23c7b998b5f305e51 Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Wed, 20 Nov 2019 22:05:12 -0600 Subject: [PATCH 05/18] Fix linting problems for Channel --- lib/structures/Channel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/structures/Channel.js b/lib/structures/Channel.js index f007e96af..46a53ea26 100644 --- a/lib/structures/Channel.js +++ b/lib/structures/Channel.js @@ -18,7 +18,7 @@ class Channel extends Base { get mention() { return `<#${this.id}>`; } - + static from(data, extra) { switch(data.type) { case 0: { From 3b99f1cb74069a6b32f8fcfcaab8005cb13656e6 Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Wed, 20 Nov 2019 22:06:41 -0600 Subject: [PATCH 06/18] Fix linting problems --- lib/structures/Guild.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/structures/Guild.js b/lib/structures/Guild.js index 9d14c29da..341c7205e 100644 --- a/lib/structures/Guild.js +++ b/lib/structures/Guild.js @@ -66,7 +66,7 @@ class Guild extends Base { } if(data.channels) { - for(let channel of data.channels) { + for(const channel of data.channels) { this.channels.add(Channel.from(channel, client)); } } From e77376c619ca75cf1b55ccef824f254773d8528f Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Wed, 20 Nov 2019 22:29:08 -0600 Subject: [PATCH 07/18] Fixed a bug --- lib/structures/Guild.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/structures/Guild.js b/lib/structures/Guild.js index 341c7205e..683e18e40 100644 --- a/lib/structures/Guild.js +++ b/lib/structures/Guild.js @@ -66,8 +66,13 @@ class Guild extends Base { } if(data.channels) { - for(const channel of data.channels) { - this.channels.add(Channel.from(channel, client)); + for(let channel of data.channels) { + channel = this.channels.add(Channel.from(channel, this)); + const parent = this.channels.get(channel.parentID); + if(parent !== undefined) { + parent.channels.add(channel); + } + client.channelGuildMap[channel.id] = this.id; } } From 69a61b5811d96cc881856d53f6c0a248a71d9bf5 Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Fri, 22 Nov 2019 09:57:33 -0600 Subject: [PATCH 08/18] Pass client only & StoreChannel --- lib/structures/Channel.js | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/lib/structures/Channel.js b/lib/structures/Channel.js index 46a53ea26..504e32f34 100644 --- a/lib/structures/Channel.js +++ b/lib/structures/Channel.js @@ -19,25 +19,28 @@ class Channel extends Base { return `<#${this.id}>`; } - static from(data, extra) { + static from(data, client) { switch(data.type) { case 0: { - return new TextChannel(data, extra); + return new TextChannel(data, client.guilds.get(data.guild_id)); } case 1: { - return new PrivateChannel(data, extra); + return new PrivateChannel(data, client); } case 2: { - return new VoiceChannel(data, extra); + return new VoiceChannel(data, client.guilds.get(data.guild_id)); } case 3: { - return new GroupChannel(data, extra); + return new GroupChannel(data, client); } case 4: { - return new CategoryChannel(data, extra); + return new CategoryChannel(data, client.guilds.get(data.guild_id)); } case 5: { - return new NewsChannel(data, extra); + return new NewsChannel(data, client.guilds.get(data.guild_id)); + } + case 6: { + return new StoreChannel(data, client.guilds.get(data.guild_id)); } } return new Channel(data); @@ -61,5 +64,6 @@ const CategoryChannel = require("./CategoryChannel"); const GroupChannel = require("./GroupChannel"); const NewsChannel = require("./NewsChannel"); const PrivateChannel = require("./PrivateChannel"); +const StoreChannel = require("./StoreChannel"); const TextChannel = require("./TextChannel"); const VoiceChannel = require("./VoiceChannel"); From f6ee219c683bedd920ed9b0ff10a8fe504078887 Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Fri, 22 Nov 2019 10:00:57 -0600 Subject: [PATCH 09/18] Add StoreChannel --- lib/structures/StoreChannel.js | 28 ++++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 lib/structures/StoreChannel.js diff --git a/lib/structures/StoreChannel.js b/lib/structures/StoreChannel.js new file mode 100644 index 000000000..ec38068ba --- /dev/null +++ b/lib/structures/StoreChannel.js @@ -0,0 +1,28 @@ +"use strict"; + +const GuildChannel = require("./GuildChannel"); + +/** +* Represents a store channel +* @extends GuildChannel +* @prop {String} id The ID of the channel +* @prop {String} mention A string that mentions the channel +* @prop {Number} type The type of the channel +* @prop {Guild} guild The guild that owns the channel +* @prop {String?} parentID The ID of the category this channel belongs to +* @prop {String} name The name of the channel +* @prop {Number} position The position of the channel +* @prop {Boolean} nsfw Whether the channel is an NSFW channel or not +* @prop {Collection} permissionOverwrites Collection of PermissionOverwrites in this channel +*/ +class StoreChannel extends GuildChannel { + constructor(data, guild) { + super(data, guild); + } + + update(data) { + super.update(data); + } +} + +module.exports = StoreChannel; From 42d357dbd3f75378e59423800c95c2b72bc43417 Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Fri, 22 Nov 2019 10:15:42 -0600 Subject: [PATCH 10/18] Fix trailing space --- lib/structures/StoreChannel.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/structures/StoreChannel.js b/lib/structures/StoreChannel.js index ec38068ba..d50142e41 100644 --- a/lib/structures/StoreChannel.js +++ b/lib/structures/StoreChannel.js @@ -19,7 +19,7 @@ class StoreChannel extends GuildChannel { constructor(data, guild) { super(data, guild); } - + update(data) { super.update(data); } From 1a7882ec4c09ef12bc0f8535be77e0bce45df65e Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Fri, 22 Nov 2019 10:16:18 -0600 Subject: [PATCH 11/18] Fix passing client --- lib/Client.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/lib/Client.js b/lib/Client.js index cc833cf5b..baccf2e13 100644 --- a/lib/Client.js +++ b/lib/Client.js @@ -413,7 +413,7 @@ class Client extends EventEmitter { rate_limit_per_user: options.rateLimitPerUser, parent_id: options.parentID, permission_overwrites: options.permissionOverwrites - }).then((channel) => Channel.from(channel, this.guilds.get(channel.guild_id) || this)); + }).then((channel) => Channel.from(channel, this)); } /** @@ -444,7 +444,7 @@ class Client extends EventEmitter { rate_limit_per_user: options.rateLimitPerUser, parent_id: options.parentID, reason: reason - }).then((channel) => Channel.from(channel, this.guilds.get(channel.guild_id) || this)); + }).then((channel) => Channel.from(channel, this)); } /** @@ -1820,7 +1820,7 @@ class Client extends EventEmitter { return Promise.reject(new Error("Eris REST mode is not enabled")); } return this.requestHandler.request("GET", Endpoints.CHANNEL(channelID), true) - .then((channel) => Channel.from(channel, this.guilds.get(channel.guild_id) || this)); + .then((channel) => Channel.from(channel, this)); } /** From 3e5b3349bc33457036aac6c37f6379b498dc92aa Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Sat, 23 Nov 2019 12:14:35 -0600 Subject: [PATCH 12/18] Pass Client into GuildChannel constructor --- lib/structures/GuildChannel.js | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/lib/structures/GuildChannel.js b/lib/structures/GuildChannel.js index 39ae80c8a..1ecbcf4a3 100644 --- a/lib/structures/GuildChannel.js +++ b/lib/structures/GuildChannel.js @@ -7,7 +7,7 @@ const {Permissions} = require("../Constants"); const PermissionOverwrite = require("./PermissionOverwrite"); /** -* Represents a guild channel. You also probably want to look at CategoryChannel, TextChannel, NewsChannel, and VoiceChannel. +* Represents a guild channel. You also probably want to look at CategoryChannel, NewsChannel, StoreChannel, TextChannel, and VoiceChannel. * @extends Channel * @prop {String} id The ID of the channel * @prop {String} mention A string that mentions the channel @@ -20,15 +20,11 @@ const PermissionOverwrite = require("./PermissionOverwrite"); * @prop {Collection} permissionOverwrites Collection of PermissionOverwrites in this channel */ class GuildChannel extends Channel { - constructor(data, guild) { + constructor(data, client) { super(data); - if(!guild && data.guild_id) { - this.guild = { - id: data.guild_id - }; - } else { - this.guild = guild; - } + this.guild = client.guilds.get(data.guild_id) || { + id: data.guild_id + }; this.update(data); } From 711957ee964c42aa224fc5953dfbc646b84fa284 Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Sat, 23 Nov 2019 12:16:25 -0600 Subject: [PATCH 13/18] No parent & fix pass client --- lib/structures/Guild.js | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/lib/structures/Guild.js b/lib/structures/Guild.js index 683e18e40..b92386015 100644 --- a/lib/structures/Guild.js +++ b/lib/structures/Guild.js @@ -66,12 +66,8 @@ class Guild extends Base { } if(data.channels) { - for(let channel of data.channels) { - channel = this.channels.add(Channel.from(channel, this)); - const parent = this.channels.get(channel.parentID); - if(parent !== undefined) { - parent.channels.add(channel); - } + for(const channel of data.channels) { + this.channels.add(Channel.from(channel, client)); client.channelGuildMap[channel.id] = this.id; } } From 853a5baec8b7a83605f8ed769abad54e9280a8c4 Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Sat, 23 Nov 2019 12:19:09 -0600 Subject: [PATCH 14/18] Fix nitpick --- lib/structures/Channel.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/lib/structures/Channel.js b/lib/structures/Channel.js index 504e32f34..21e3ce214 100644 --- a/lib/structures/Channel.js +++ b/lib/structures/Channel.js @@ -22,25 +22,25 @@ class Channel extends Base { static from(data, client) { switch(data.type) { case 0: { - return new TextChannel(data, client.guilds.get(data.guild_id)); + return new TextChannel(data, client); } case 1: { return new PrivateChannel(data, client); } case 2: { - return new VoiceChannel(data, client.guilds.get(data.guild_id)); + return new VoiceChannel(data, client); } case 3: { return new GroupChannel(data, client); } case 4: { - return new CategoryChannel(data, client.guilds.get(data.guild_id)); + return new CategoryChannel(data, client); } case 5: { - return new NewsChannel(data, client.guilds.get(data.guild_id)); + return new NewsChannel(data, client); } case 6: { - return new StoreChannel(data, client.guilds.get(data.guild_id)); + return new StoreChannel(data, client); } } return new Channel(data); From 83328228de5e0d7b5c2b661fd701fc93fe25d112 Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Sat, 23 Nov 2019 12:47:59 -0600 Subject: [PATCH 15/18] Kill NewsChannel#update() --- lib/structures/NewsChannel.js | 4 ---- 1 file changed, 4 deletions(-) diff --git a/lib/structures/NewsChannel.js b/lib/structures/NewsChannel.js index 670d5c9bc..5b1f79368 100644 --- a/lib/structures/NewsChannel.js +++ b/lib/structures/NewsChannel.js @@ -26,10 +26,6 @@ class NewsChannel extends TextChannel { this.rateLimitPerUser = 0; this.update(data); } - - update(data) { - super.update(data); - } } module.exports = NewsChannel; From c3061a21a877d5df1e728b94c13a2bc7524e6d3c Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Sat, 23 Nov 2019 12:48:41 -0600 Subject: [PATCH 16/18] Kill useless constructor --- lib/structures/StoreChannel.js | 7 ------- 1 file changed, 7 deletions(-) diff --git a/lib/structures/StoreChannel.js b/lib/structures/StoreChannel.js index d50142e41..bb719be2b 100644 --- a/lib/structures/StoreChannel.js +++ b/lib/structures/StoreChannel.js @@ -16,13 +16,6 @@ const GuildChannel = require("./GuildChannel"); * @prop {Collection} permissionOverwrites Collection of PermissionOverwrites in this channel */ class StoreChannel extends GuildChannel { - constructor(data, guild) { - super(data, guild); - } - - update(data) { - super.update(data); - } } module.exports = StoreChannel; From 8bd740b687026045e1530dafca18b08f873bd720 Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Sat, 23 Nov 2019 14:21:52 -0600 Subject: [PATCH 17/18] yes --- lib/structures/TextChannel.js | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/lib/structures/TextChannel.js b/lib/structures/TextChannel.js index fdcc242d2..3f9dc6d11 100644 --- a/lib/structures/TextChannel.js +++ b/lib/structures/TextChannel.js @@ -23,12 +23,9 @@ const Message = require("./Message"); * @prop {Number} rateLimitPerUser The ratelimit of the channel, in seconds. 0 means no ratelimit is enabled */ class TextChannel extends GuildChannel { - constructor(data, guild, messageLimit) { - super(data, guild); - if(messageLimit == null && guild) { - messageLimit = guild.shard.client.options.messageLimit; - } - this.messages = new Collection(Message, messageLimit); + constructor(data, client, messageLimit) { + super(data, client); + this.messages = new Collection(Message, messageLimit || client.options.messageLimit); this.lastMessageID = data.last_message_id || null; this.rateLimitPerUser = data.rate_limit_per_user == undefined ? null : data.rate_limit_per_user; this.lastPinTimestamp = data.last_pin_timestamp ? Date.parse(data.last_pin_timestamp) : null; From 2f5a998483925b4e52b63cbdda6c8d0177c6b18f Mon Sep 17 00:00:00 2001 From: Apacheli#6009 <43933794+Apacheli@users.noreply.github.com> Date: Sat, 23 Nov 2019 14:30:30 -0600 Subject: [PATCH 18/18] yes --- lib/structures/TextChannel.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/structures/TextChannel.js b/lib/structures/TextChannel.js index 3f9dc6d11..1b939a63c 100644 --- a/lib/structures/TextChannel.js +++ b/lib/structures/TextChannel.js @@ -25,9 +25,9 @@ const Message = require("./Message"); class TextChannel extends GuildChannel { constructor(data, client, messageLimit) { super(data, client); - this.messages = new Collection(Message, messageLimit || client.options.messageLimit); + this.messages = new Collection(Message, messageLimit == null ? client.options.messageLimit : messageLimit); this.lastMessageID = data.last_message_id || null; - this.rateLimitPerUser = data.rate_limit_per_user == undefined ? null : data.rate_limit_per_user; + this.rateLimitPerUser = data.rate_limit_per_user == null ? null : data.rate_limit_per_user; this.lastPinTimestamp = data.last_pin_timestamp ? Date.parse(data.last_pin_timestamp) : null; this.update(data); }