From d6b7d310470dc6600fc1782050808af7aee9aa88 Mon Sep 17 00:00:00 2001 From: stupid cat Date: Sat, 29 Apr 2017 07:31:32 -0600 Subject: [PATCH] Better ClientUser#setStatus for self bots (#1428) * better setstatus for selfbots * make both calls * must return * use setpresence, set invisible --- src/structures/ClientUser.js | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/src/structures/ClientUser.js b/src/structures/ClientUser.js index b45f6672c..76b82b7e1 100644 --- a/src/structures/ClientUser.js +++ b/src/structures/ClientUser.js @@ -1,6 +1,8 @@ const User = require('./User'); const Collection = require('../util/Collection'); const ClientUserSettings = require('./ClientUserSettings'); +const Constants = require('../util/Constants'); + /** * Represents the logged in client's Discord user * @extends {User} @@ -178,7 +180,12 @@ class ClientUser extends User { if (data.status) { if (typeof data.status !== 'string') throw new TypeError('Status must be a string'); - status = data.status; + if (this.bot) { + status = data.status; + } else { + this.settings.update(Constants.UserSettingsMap.status, data.status); + status = 'invisible'; + } } if (data.game) { @@ -232,10 +239,12 @@ class ClientUser extends User { */ setGame(game, streamingURL) { if (!game) return this.setPresence({ game: null }); - return this.setPresence({ game: { - name: game, - url: streamingURL, - } }); + return this.setPresence({ + game: { + name: game, + url: streamingURL, + }, + }); } /**