mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-16 11:33:30 +01:00
Made Client.browser a getter
This commit is contained in:
@@ -23,12 +23,6 @@ class Client extends EventEmitter {
|
|||||||
constructor(options = {}) {
|
constructor(options = {}) {
|
||||||
super();
|
super();
|
||||||
|
|
||||||
/**
|
|
||||||
* Whether the client is in a browser environment
|
|
||||||
* @type {boolean}
|
|
||||||
*/
|
|
||||||
this.browser = typeof window !== 'undefined';
|
|
||||||
|
|
||||||
// Obtain shard details from environment
|
// Obtain shard details from environment
|
||||||
if (!options.shardId && 'SHARD_ID' in process.env) options.shardId = Number(process.env.SHARD_ID);
|
if (!options.shardId && 'SHARD_ID' in process.env) options.shardId = Number(process.env.SHARD_ID);
|
||||||
if (!options.shardCount && 'SHARD_COUNT' in process.env) options.shardCount = Number(process.env.SHARD_COUNT);
|
if (!options.shardCount && 'SHARD_COUNT' in process.env) options.shardCount = Number(process.env.SHARD_COUNT);
|
||||||
@@ -212,6 +206,15 @@ class Client extends EventEmitter {
|
|||||||
return this.readyAt ? this.readyAt.getTime() : null;
|
return this.readyAt ? this.readyAt.getTime() : null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Whether the client is in a browser environment
|
||||||
|
* @type {boolean}
|
||||||
|
* @readonly
|
||||||
|
*/
|
||||||
|
get browser() {
|
||||||
|
return typeof window !== 'undefined';
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Logs the client in. If successful, resolves with the account's token. <warn>If you're making a bot, it's
|
* Logs the client in. If successful, resolves with the account's token. <warn>If you're making a bot, it's
|
||||||
* much better to use a bot account rather than a user account.
|
* much better to use a bot account rather than a user account.
|
||||||
|
|||||||
Reference in New Issue
Block a user