Fix emoji events (fixes #1333)

This commit is contained in:
Amish Shah
2017-04-05 17:05:27 +01:00
parent 140fd4ad4c
commit 970bfffc46
5 changed files with 57 additions and 40 deletions

View File

@@ -121,13 +121,6 @@ class Guild {
*/
this.applicationID = data.application_id;
/**
* A collection of emojis that are in this guild. The key is the emoji's ID, the value is the emoji.
* @type {Collection<Snowflake, Emoji>}
*/
this.emojis = new Collection();
for (const emoji of data.emojis) this.emojis.set(emoji.id, new Emoji(this, emoji));
/**
* The time in seconds before a user is counted as "away from keyboard".
* @type {?number}
@@ -216,6 +209,20 @@ class Guild {
}
}
}
if (!this.emojis) {
/**
* A collection of emojis that are in this guild. The key is the emoji's ID, the value is the emoji.
* @type {Collection<Snowflake, Emoji>}
*/
this.emojis = new Collection();
for (const emoji of data.emojis) this.emojis.set(emoji.id, new Emoji(this, emoji));
} else {
this.client.actions.GuildEmojisUpdate.handle({
guild_id: this.id,
emojis: data.emojis,
});
}
}
/**