This commit is contained in:
Amish Shah
2017-08-26 13:43:13 +01:00
parent 51fe80fd11
commit 30dd3e0cff
2 changed files with 11 additions and 1 deletions

View File

@@ -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);

View File

@@ -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;