Skip to content

Commit

Permalink
fix(ClientUser#setStatus): resetting activity
Browse files Browse the repository at this point in the history
The method would pass in null if no activity was passed, so this takes the current client presence instead of deleting it.
  • Loading branch information
Lewdcario committed Jan 24, 2018
1 parent a832b56 commit 7e0e457
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/stores/ClientPresenceStore.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class ClientPresenceStore extends PresenceStore {
since: since != null ? since : null, // eslint-disable-line eqeqeq
status: status || this.clientPresence.status,
game: activity ? {
type: typeof activity.type === 'number' ? activity.type : ActivityTypes.indexOf(activity.type),
type: activity.type,
name: activity.name,
url: activity.url,
details: activity.details || undefined,
Expand All @@ -54,9 +54,14 @@ class ClientPresenceStore extends PresenceStore {
application_id: applicationID || undefined,
secrets: activity.secrets || 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.client.ws.send({ op: OPCodes.STATUS_UPDATE, d: packet });
return this.clientPresence;
Expand Down

0 comments on commit 7e0e457

Please sign in to comment.