mirror of
https://github.com/danbulant/discord.js
synced 2026-05-24 20:42:27 +00:00
Fix #1684
This commit is contained in:
parent
51fe80fd11
commit
30dd3e0cff
2 changed files with 11 additions and 1 deletions
|
|
@ -41,7 +41,7 @@ class PresenceUpdateHandler extends AbstractHandler {
|
|||
}
|
||||
const oldMember = member._clone();
|
||||
if (member.presence) {
|
||||
oldMember.frozenPresence = Util.cloneObject(member.presence);
|
||||
oldMember.frozenPresence = member.presence._clone();
|
||||
}
|
||||
guild._setPresence(user.id, data);
|
||||
client.emit(Constants.Events.PRESENCE_UPDATE, oldMember, member);
|
||||
|
|
|
|||
|
|
@ -28,6 +28,12 @@ class Presence {
|
|||
this.game = data.game ? new Game(data.game) : null;
|
||||
}
|
||||
|
||||
_clone() {
|
||||
const clone = Object.assign(Object.create(this), this);
|
||||
if (this.game) clone.game = this.game._clone();
|
||||
return clone;
|
||||
}
|
||||
|
||||
/**
|
||||
* Whether this presence is equal to another
|
||||
* @param {Presence} presence The presence to compare with
|
||||
|
|
@ -79,6 +85,10 @@ class Game {
|
|||
this.url === game.url
|
||||
);
|
||||
}
|
||||
|
||||
_clone() {
|
||||
return Object.assign(Object.create(this), this);
|
||||
}
|
||||
}
|
||||
|
||||
exports.Presence = Presence;
|
||||
|
|
|
|||
Loading…
Reference in a new issue