mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-20 13:33:30 +01:00
fix: add presence to ClientPresence from ClientOptions (#5041)
This commit is contained in:
@@ -131,7 +131,7 @@ class Client extends BaseClient {
|
|||||||
* @private
|
* @private
|
||||||
* @type {ClientPresence}
|
* @type {ClientPresence}
|
||||||
*/
|
*/
|
||||||
this.presence = new ClientPresence(this);
|
this.presence = new ClientPresence(this, options.presence);
|
||||||
|
|
||||||
Object.defineProperty(this, 'token', { writable: true });
|
Object.defineProperty(this, 'token', { writable: true });
|
||||||
if (!browser && !this.token && 'DISCORD_TOKEN' in process.env) {
|
if (!browser && !this.token && 'DISCORD_TOKEN' in process.env) {
|
||||||
|
|||||||
@@ -11,7 +11,7 @@ class ClientPresence extends Presence {
|
|||||||
* @param {Object} [data={}] The data for the client presence
|
* @param {Object} [data={}] The data for the client presence
|
||||||
*/
|
*/
|
||||||
constructor(client, data = {}) {
|
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) {
|
async set(presence) {
|
||||||
|
|||||||
@@ -155,7 +155,7 @@ class Activity {
|
|||||||
* The type of the activity status
|
* The type of the activity status
|
||||||
* @type {ActivityType}
|
* @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
|
* If the activity is being streamed, a link to the stream
|
||||||
|
|||||||
Reference in New Issue
Block a user