diff --git a/docs/docs_client.rst b/docs/docs_client.rst index 79e29b717..b4dfe918b 100755 --- a/docs/docs_client.rst +++ b/docs/docs_client.rst @@ -64,6 +64,11 @@ shardId A zero-based integer representing the value of the current shard. +bot +~~~~~~~ + +Boolean. Use 'Bot my_token' when authorizing. Default is true, should be false if user bot. + -------- Attributes diff --git a/src/Client/Client.js b/src/Client/Client.js index 2be337ba6..712ec7200 100755 --- a/src/Client/Client.js +++ b/src/Client/Client.js @@ -54,6 +54,7 @@ export default class Client extends EventEmitter { this.options.shardId = options.shardId || 0; this.options.shardCount = options.shardCount || 0; this.options.disableEveryone = options.disableEveryone || false; + this.options.bot = options.bot === undefined || options.bot === true ? true : false; if (typeof options.shardCount === "number" && typeof options.shardId === "number" && options.shardCount > 0) { this.options.shard = [options.shardId, options.shardCount]; diff --git a/src/Client/InternalClient.js b/src/Client/InternalClient.js index 3af7ec6a8..342b2f0b1 100755 --- a/src/Client/InternalClient.js +++ b/src/Client/InternalClient.js @@ -521,10 +521,12 @@ export default class InternalClient { this.email = email; this.password = password; + var self = this; return this.getGateway() .then(url => { - this.createWS(url); - return token; + self.token = self.client.options.bot && !self.token.startsWith("Bot ") ? `Bot ${self.token}` : self.token; + self.createWS(url); + return self.token; }); }