From e28cab108cc9d6f43cab3907ad6d527c3c8118f2 Mon Sep 17 00:00:00 2001 From: Khaazz Date: Mon, 25 Nov 2019 20:18:35 +0100 Subject: [PATCH 1/2] Fixes not passing client in Channel.from + doc --- lib/gateway/Shard.js | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/lib/gateway/Shard.js b/lib/gateway/Shard.js index 59b9eef5b..31a2c4740 100644 --- a/lib/gateway/Shard.js +++ b/lib/gateway/Shard.js @@ -871,6 +871,11 @@ class Shard extends EventEmitter { } channel.guild.channels.add(channel, this.client); this.client.channelGuildMap[packet.d.id] = packet.d.guild_id; + /** + * Fired when a channel is created + * @event Client#channelCreate + * @prop {PrivateChannel | TextChannel | VoiceChannel | CategoryChannel | StoreChannel} channel The channel + */ this.emit("channelCreate", channel); } else if(channel instanceof PrivateChannel) { if(channel instanceof GroupChannel) { @@ -920,7 +925,7 @@ class Shard extends EventEmitter { channel.update(packet.d); } else { this.emit("debug", `Channel ${packet.d.id} changed from type ${oldType} to ${packet.d.type}`); - const newChannel = Channel.from(packet.d); + const newChannel = Channel.from(packet.d, this.client); if(packet.d.guild_id) { const guild = this.client.guilds.get(packet.d.guild_id); if(!guild) { @@ -947,7 +952,7 @@ class Shard extends EventEmitter { /** * Fired when a channel is updated * @event Client#channelUpdate - * @prop {PrivateChannel | TextChannel | VoiceChannel | CategoryChannel} channel The updated channel + * @prop {PrivateChannel | TextChannel | VoiceChannel | CategoryChannel | StoreChannel} channel The updated channel * @prop {Object} oldChannel The old channel data * @prop {String} oldChannel.name The name of the channel * @prop {Number} oldChannel.position The position of the channel From aa106f7913adce9c05778a929bb5408dfcdf1921 Mon Sep 17 00:00:00 2001 From: abal Date: Mon, 25 Nov 2019 14:47:47 -0800 Subject: [PATCH 2/2] Fix event doc types --- lib/gateway/Shard.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gateway/Shard.js b/lib/gateway/Shard.js index 31a2c4740..de1bf89f9 100644 --- a/lib/gateway/Shard.js +++ b/lib/gateway/Shard.js @@ -874,7 +874,7 @@ class Shard extends EventEmitter { /** * Fired when a channel is created * @event Client#channelCreate - * @prop {PrivateChannel | TextChannel | VoiceChannel | CategoryChannel | StoreChannel} channel The channel + * @prop {TextChannel | VoiceChannel | CategoryChannel | StoreChannel | NewsChannel | GuildChannel | PrivateChannel} channel The channel */ this.emit("channelCreate", channel); } else if(channel instanceof PrivateChannel) { @@ -952,7 +952,7 @@ class Shard extends EventEmitter { /** * Fired when a channel is updated * @event Client#channelUpdate - * @prop {PrivateChannel | TextChannel | VoiceChannel | CategoryChannel | StoreChannel} channel The updated channel + * @prop {TextChannel | VoiceChannel | CategoryChannel | StoreChannel | NewsChannel | GuildChannel | PrivateChannel} channel The updated channel * @prop {Object} oldChannel The old channel data * @prop {String} oldChannel.name The name of the channel * @prop {Number} oldChannel.position The position of the channel