mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
Add 'Bot' prefix to token (#510)
* Add 'Bot' prefix to token * Add option for token prefix * Maybe this is what abal meant? * Change option name * Check if token already starts with prefix
This commit is contained in:
@@ -64,6 +64,11 @@ shardId
|
|||||||
|
|
||||||
A zero-based integer representing the value of the current shard.
|
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
|
Attributes
|
||||||
|
|||||||
@@ -54,6 +54,7 @@ export default class Client extends EventEmitter {
|
|||||||
this.options.shardId = options.shardId || 0;
|
this.options.shardId = options.shardId || 0;
|
||||||
this.options.shardCount = options.shardCount || 0;
|
this.options.shardCount = options.shardCount || 0;
|
||||||
this.options.disableEveryone = options.disableEveryone || false;
|
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) {
|
if (typeof options.shardCount === "number" && typeof options.shardId === "number" && options.shardCount > 0) {
|
||||||
this.options.shard = [options.shardId, options.shardCount];
|
this.options.shard = [options.shardId, options.shardCount];
|
||||||
|
|||||||
@@ -521,10 +521,12 @@ export default class InternalClient {
|
|||||||
this.email = email;
|
this.email = email;
|
||||||
this.password = password;
|
this.password = password;
|
||||||
|
|
||||||
|
var self = this;
|
||||||
return this.getGateway()
|
return this.getGateway()
|
||||||
.then(url => {
|
.then(url => {
|
||||||
this.createWS(url);
|
self.token = self.client.options.bot && !self.token.startsWith("Bot ") ? `Bot ${self.token}` : self.token;
|
||||||
return token;
|
self.createWS(url);
|
||||||
|
return self.token;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user