mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
src: Don't use the GuildMemberRoleStore to patch the GuildMember _roles (#3226)
* src: Don't use the GuildMemberRoleStore for patching GuildMember#_roles * src: Remove usage of _patch from the store * src: Finish up clone changes
This commit is contained in:
@@ -84,7 +84,7 @@ class GuildMemberRoleStore extends Collection {
|
||||
await this.client.api.guilds[this.guild.id].members[this.member.id].roles[roleOrRoles.id].put({ reason });
|
||||
|
||||
const clone = this.member._clone();
|
||||
clone.roles._patch([...this.keys(), roleOrRoles.id]);
|
||||
clone._roles = [...this.keys(), roleOrRoles.id];
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
@@ -116,7 +116,7 @@ class GuildMemberRoleStore extends Collection {
|
||||
|
||||
const clone = this.member._clone();
|
||||
const newRoles = this.filter(role => role.id !== roleOrRoles.id);
|
||||
clone.roles._patch([...newRoles.keys()]);
|
||||
clone._roles = [...newRoles.keys()];
|
||||
return clone;
|
||||
}
|
||||
}
|
||||
@@ -141,13 +141,9 @@ class GuildMemberRoleStore extends Collection {
|
||||
return this.member.edit({ roles }, reason);
|
||||
}
|
||||
|
||||
_patch(roles) {
|
||||
this.member._roles = roles;
|
||||
}
|
||||
|
||||
clone() {
|
||||
const clone = new this.constructor(this.member);
|
||||
clone._patch(this.keyArray());
|
||||
clone.member._roles = [...this.keyArray()];
|
||||
return clone;
|
||||
}
|
||||
|
||||
|
||||
@@ -76,7 +76,7 @@ class GuildMember extends Base {
|
||||
if (data.joined_at) this.joinedTimestamp = new Date(data.joined_at).getTime();
|
||||
|
||||
if (data.user) this.user = this.guild.client.users.add(data.user);
|
||||
if (data.roles) this.roles._patch(data.roles);
|
||||
if (data.roles) this._roles = data.roles;
|
||||
}
|
||||
|
||||
_clone() {
|
||||
|
||||
Reference in New Issue
Block a user