From 39013b1242d9bc0a0f3a462a9dea7a832da64850 Mon Sep 17 00:00:00 2001 From: Isabella Date: Sun, 3 Sep 2017 05:00:12 -0500 Subject: [PATCH] fix: made options.type optional in ClientUser#setActivity (#1875) * fix: made options.type optional in ClientUser#setActivity * some changes, smol fix due to too many types being possible, it should just be defaulted to 0. this means streamers will have to set the type manually, though. also mistake with activity.name check --- src/stores/ClientPresenceStore.js | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/stores/ClientPresenceStore.js b/src/stores/ClientPresenceStore.js index 537beee0d..f29b95096 100644 --- a/src/stores/ClientPresenceStore.js +++ b/src/stores/ClientPresenceStore.js @@ -2,6 +2,7 @@ const PresenceStore = require('./PresenceStore'); const Collection = require('../util/Collection'); const Constants = require('../util/Constants'); const { Presence } = require('../structures/Presence'); +const { TypeError } = require('../errors'); class ClientPresenceStore extends PresenceStore { constructor(...args) { @@ -14,7 +15,9 @@ class ClientPresenceStore extends PresenceStore { }); } - async setClientPresence({ status, since, afk, activity }) { + async setClientPresence({ status, since, afk, activity }) { // eslint-disable-line complexity + if (typeof activity.name !== 'string') throw new TypeError('INVALID_TYPE', 'name', 'string'); + if (!activity.type) activity.type = 0; const applicationID = activity && (activity.application ? activity.application.id || activity.application : null); let assets = new Collection(); if (activity && activity.assets && applicationID) {