mirror of
https://github.com/danbulant/discord.js
synced 2026-07-08 04:31:05 +00:00
fix: add clone methods to GuildMember and GuildMemberRoleStore
Fixes #2312 This adds clone method to both classes to achieve the expected behaviour when cloning a GuildMember, also cloning their roles store
This commit is contained in:
parent
9810bdbc5f
commit
32e2dd212e
2 changed files with 12 additions and 0 deletions
|
|
@ -128,6 +128,12 @@ class GuildMemberRoleStore extends DataStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
clone() {
|
||||||
|
const clone = new this.constructor(this.member);
|
||||||
|
clone._patch(this.keyArray());
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Resolves a RoleResolvable to a Role object.
|
* Resolves a RoleResolvable to a Role object.
|
||||||
* @method resolve
|
* @method resolve
|
||||||
|
|
|
||||||
|
|
@ -75,6 +75,12 @@ class GuildMember extends Base {
|
||||||
if (data.roles) this.roles._patch(data.roles);
|
if (data.roles) this.roles._patch(data.roles);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_clone() {
|
||||||
|
const clone = super._clone();
|
||||||
|
clone.roles = this.roles.clone();
|
||||||
|
return clone;
|
||||||
|
}
|
||||||
|
|
||||||
get voiceState() {
|
get voiceState() {
|
||||||
return this._frozenVoiceState || this.guild.voiceStates.get(this.id) || {};
|
return this._frozenVoiceState || this.guild.voiceStates.get(this.id) || {};
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue