mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 03:53:29 +01:00
fix(ClientUser#setStatus): resetting activity
The method would pass in null if no activity was passed, so this takes the current client presence instead of deleting it.
This commit is contained in:
@@ -38,7 +38,7 @@ class ClientPresenceStore extends PresenceStore {
|
|||||||
since: since != null ? since : null, // eslint-disable-line eqeqeq
|
since: since != null ? since : null, // eslint-disable-line eqeqeq
|
||||||
status: status || this.clientPresence.status,
|
status: status || this.clientPresence.status,
|
||||||
game: activity ? {
|
game: activity ? {
|
||||||
type: typeof activity.type === 'number' ? activity.type : ActivityTypes.indexOf(activity.type),
|
type: activity.type,
|
||||||
name: activity.name,
|
name: activity.name,
|
||||||
url: activity.url,
|
url: activity.url,
|
||||||
details: activity.details || undefined,
|
details: activity.details || undefined,
|
||||||
@@ -54,9 +54,14 @@ class ClientPresenceStore extends PresenceStore {
|
|||||||
application_id: applicationID || undefined,
|
application_id: applicationID || undefined,
|
||||||
secrets: activity.secrets || undefined,
|
secrets: activity.secrets || undefined,
|
||||||
instance: activity.instance || undefined,
|
instance: activity.instance || undefined,
|
||||||
} : null,
|
} : this.clientPresence.activity,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
if (packet.game) {
|
||||||
|
packet.game.type = typeof packet.game.type === 'number' ?
|
||||||
|
packet.game.type : ActivityTypes.indexOf(packet.game.type)
|
||||||
|
}
|
||||||
|
|
||||||
this.clientPresence.patch(packet);
|
this.clientPresence.patch(packet);
|
||||||
this.client.ws.send({ op: OPCodes.STATUS_UPDATE, d: packet });
|
this.client.ws.send({ op: OPCodes.STATUS_UPDATE, d: packet });
|
||||||
return this.clientPresence;
|
return this.clientPresence;
|
||||||
|
|||||||
Reference in New Issue
Block a user