mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 03:23:29 +01:00
Fix #1684
This commit is contained in:
@@ -41,7 +41,7 @@ class PresenceUpdateHandler extends AbstractHandler {
|
|||||||
}
|
}
|
||||||
const oldMember = member._clone();
|
const oldMember = member._clone();
|
||||||
if (member.presence) {
|
if (member.presence) {
|
||||||
oldMember.frozenPresence = Util.cloneObject(member.presence);
|
oldMember.frozenPresence = member.presence._clone();
|
||||||
}
|
}
|
||||||
guild._setPresence(user.id, data);
|
guild._setPresence(user.id, data);
|
||||||
client.emit(Constants.Events.PRESENCE_UPDATE, oldMember, member);
|
client.emit(Constants.Events.PRESENCE_UPDATE, oldMember, member);
|
||||||
|
|||||||
@@ -28,6 +28,12 @@ class Presence {
|
|||||||
this.game = data.game ? new Game(data.game) : null;
|
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
|
* Whether this presence is equal to another
|
||||||
* @param {Presence} presence The presence to compare with
|
* @param {Presence} presence The presence to compare with
|
||||||
@@ -79,6 +85,10 @@ class Game {
|
|||||||
this.url === game.url
|
this.url === game.url
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_clone() {
|
||||||
|
return Object.assign(Object.create(this), this);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
exports.Presence = Presence;
|
exports.Presence = Presence;
|
||||||
|
|||||||
Reference in New Issue
Block a user