Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes not passing client in Channel.from #574

Merged
merged 2 commits into from Nov 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 7 additions & 2 deletions lib/gateway/Shard.js
Expand Up @@ -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 {TextChannel | VoiceChannel | CategoryChannel | StoreChannel | NewsChannel | GuildChannel | PrivateChannel} channel The channel
*/
this.emit("channelCreate", channel);
} else if(channel instanceof PrivateChannel) {
if(channel instanceof GroupChannel) {
Expand Down Expand Up @@ -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) {
Expand All @@ -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 {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
Expand Down