From 91a7d4f80e60cc3e25421c7e2d89cd60b3eeb236 Mon Sep 17 00:00:00 2001 From: Schuyler Cebulskie Date: Sat, 10 Sep 2016 12:39:28 -0400 Subject: [PATCH] Move channel type to constructors --- src/structures/DMChannel.js | 2 +- src/structures/GroupDMChannel.js | 2 +- src/structures/TextChannel.js | 2 +- src/structures/VoiceChannel.js | 4 ++-- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/structures/DMChannel.js b/src/structures/DMChannel.js index bd2e4d1d5..e9904a6da 100644 --- a/src/structures/DMChannel.js +++ b/src/structures/DMChannel.js @@ -11,6 +11,7 @@ const Collection = require('../util/Collection'); class DMChannel extends Channel { constructor(client, data) { super(client, data); + this.type = 'dm'; this.messages = new Collection(); this._typing = new Map(); } @@ -24,7 +25,6 @@ class DMChannel extends Channel { */ this.recipient = this.client.dataManager.newUser(data.recipients[0]); - this.type = 'dm'; this.lastMessageID = data.last_message_id; } diff --git a/src/structures/GroupDMChannel.js b/src/structures/GroupDMChannel.js index c625e5275..c14ee34a8 100644 --- a/src/structures/GroupDMChannel.js +++ b/src/structures/GroupDMChannel.js @@ -33,6 +33,7 @@ const arraysEqual = require('../util/ArraysEqual'); class GroupDMChannel extends Channel { constructor(client, data) { super(client, data); + this.type = 'group'; this.messages = new Collection(); this._typing = new Map(); } @@ -73,7 +74,6 @@ class GroupDMChannel extends Channel { } } - this.type = 'group'; this.lastMessageID = data.last_message_id; } diff --git a/src/structures/TextChannel.js b/src/structures/TextChannel.js index 4c934530d..4652d496e 100644 --- a/src/structures/TextChannel.js +++ b/src/structures/TextChannel.js @@ -10,6 +10,7 @@ const Collection = require('../util/Collection'); class TextChannel extends GuildChannel { constructor(guild, data) { super(guild, data); + this.type = 'text'; this.messages = new Collection(); this._typing = new Map(); } @@ -23,7 +24,6 @@ class TextChannel extends GuildChannel { */ this.topic = data.topic; - this.type = 'text'; this.lastMessageID = data.last_message_id; } diff --git a/src/structures/VoiceChannel.js b/src/structures/VoiceChannel.js index ce1463457..fcc2e2c68 100644 --- a/src/structures/VoiceChannel.js +++ b/src/structures/VoiceChannel.js @@ -14,6 +14,8 @@ class VoiceChannel extends GuildChannel { * @type {Collection} */ this.members = new Collection(); + + this.type = 'voice'; } setup(data) { @@ -30,8 +32,6 @@ class VoiceChannel extends GuildChannel { * @type {number} */ this.userLimit = data.user_limit; - - this.type = 'voice'; } /**