From 9c7fe34c50808ba080527a1919b1846ed6585d4d Mon Sep 17 00:00:00 2001 From: Mirdukkk <44965055+Mirdukkk@users.noreply.github.com> Date: Sun, 13 Dec 2020 05:14:23 +0300 Subject: [PATCH] fix: add presence to ClientPresence from ClientOptions (#5041) --- src/client/Client.js | 2 +- src/structures/ClientPresence.js | 2 +- src/structures/Presence.js | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/client/Client.js b/src/client/Client.js index cefd4ebb6f4b..f3fd68a20061 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -131,7 +131,7 @@ class Client extends BaseClient { * @private * @type {ClientPresence} */ - this.presence = new ClientPresence(this); + this.presence = new ClientPresence(this, options.presence); Object.defineProperty(this, 'token', { writable: true }); if (!browser && !this.token && 'DISCORD_TOKEN' in process.env) { diff --git a/src/structures/ClientPresence.js b/src/structures/ClientPresence.js index a39ba00633c5..6c0955627318 100644 --- a/src/structures/ClientPresence.js +++ b/src/structures/ClientPresence.js @@ -11,7 +11,7 @@ class ClientPresence extends Presence { * @param {Object} [data={}] The data for the client presence */ constructor(client, data = {}) { - super(client, Object.assign(data, { status: 'online', user: { id: null } })); + super(client, Object.assign(data, { status: data.status || 'online', user: { id: null } })); } async set(presence) { diff --git a/src/structures/Presence.js b/src/structures/Presence.js index 2ae6b8c0d99f..be4dca665ebb 100644 --- a/src/structures/Presence.js +++ b/src/structures/Presence.js @@ -155,7 +155,7 @@ class Activity { * The type of the activity status * @type {ActivityType} */ - this.type = ActivityTypes[data.type]; + this.type = ActivityTypes[data.type] || ActivityTypes[ActivityTypes.indexOf(data.type)]; /** * If the activity is being streamed, a link to the stream