mirror of
https://github.com/danbulant/discord.js
synced 2026-06-09 01:31:29 +00:00
Better ClientUser#setStatus for self bots (#1428)
* better setstatus for selfbots * make both calls * must return * use setpresence, set invisible
This commit is contained in:
parent
13672cc637
commit
d6b7d31047
1 changed files with 14 additions and 5 deletions
|
|
@ -1,6 +1,8 @@
|
||||||
const User = require('./User');
|
const User = require('./User');
|
||||||
const Collection = require('../util/Collection');
|
const Collection = require('../util/Collection');
|
||||||
const ClientUserSettings = require('./ClientUserSettings');
|
const ClientUserSettings = require('./ClientUserSettings');
|
||||||
|
const Constants = require('../util/Constants');
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Represents the logged in client's Discord user
|
* Represents the logged in client's Discord user
|
||||||
* @extends {User}
|
* @extends {User}
|
||||||
|
|
@ -178,7 +180,12 @@ class ClientUser extends User {
|
||||||
|
|
||||||
if (data.status) {
|
if (data.status) {
|
||||||
if (typeof data.status !== 'string') throw new TypeError('Status must be a string');
|
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) {
|
if (data.game) {
|
||||||
|
|
@ -232,10 +239,12 @@ class ClientUser extends User {
|
||||||
*/
|
*/
|
||||||
setGame(game, streamingURL) {
|
setGame(game, streamingURL) {
|
||||||
if (!game) return this.setPresence({ game: null });
|
if (!game) return this.setPresence({ game: null });
|
||||||
return this.setPresence({ game: {
|
return this.setPresence({
|
||||||
name: game,
|
game: {
|
||||||
url: streamingURL,
|
name: game,
|
||||||
} });
|
url: streamingURL,
|
||||||
|
},
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue