mirror of
https://github.com/danbulant/discord.js
synced 2026-07-03 02:00:43 +00: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:
parent
1963bcfa10
commit
ce198ef005
3 changed files with 10 additions and 2 deletions
|
|
@ -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;
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue