fix: GuildMemberStore now works with custom structures again

This commit is contained in:
Amish Shah
2018-08-13 16:21:11 +01:00
parent 332e30d31e
commit d276850c52
2 changed files with 4 additions and 6 deletions

View File

@@ -15,11 +15,7 @@ class GuildMemberStore extends DataStore {
}
add(data, cache = true) {
const existing = this.get(data.user.id);
if (existing) return existing._patch(data);
const entry = new GuildMember(this.client, data, this.guild);
if (cache) this.set(data.user.id, entry);
return entry;
return super.add(data, cache, { id: data.user.id, extras: [this.guild] });
}
/**

View File

@@ -164,7 +164,9 @@ class Message extends Base {
*/
this._edits = [];
if (data.member && this.guild && this.author) {
if (this.member) {
this.member._patch(data.member);
} else if (data.member && this.guild && this.author) {
this.guild.members.add(Object.assign(data.member, { user: this.author }));
}
}