Skip to content

Commit

Permalink
fix(BaseClient): Remove selfbot ability (#6429)
Browse files Browse the repository at this point in the history
  • Loading branch information
xHyroM committed Aug 16, 2021
1 parent d289d5c commit 9a833b1
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/client/BaseClient.js
Expand Up @@ -24,7 +24,7 @@ class BaseClient extends EventEmitter {
* @type {RESTManager}
* @private
*/
this.rest = new RESTManager(this, options._tokenType);
this.rest = new RESTManager(this);
}

/**
Expand Down
2 changes: 1 addition & 1 deletion src/client/Client.js
Expand Up @@ -35,7 +35,7 @@ class Client extends BaseClient {
* @param {ClientOptions} options Options for the client
*/
constructor(options) {
super(Object.assign({ _tokenType: 'Bot' }, options));
super(options);

const data = require('worker_threads').workerData ?? process.env;
const defaults = Options.createDefault();
Expand Down
5 changes: 2 additions & 3 deletions src/rest/RESTManager.js
Expand Up @@ -8,10 +8,9 @@ const { Error } = require('../errors');
const { Endpoints } = require('../util/Constants');

class RESTManager {
constructor(client, tokenPrefix = 'Bot') {
constructor(client) {
this.client = client;
this.handlers = new Collection();
this.tokenPrefix = tokenPrefix;
this.versioned = true;
this.globalLimit = client.options.restGlobalRateLimit > 0 ? client.options.restGlobalRateLimit : Infinity;
this.globalRemaining = this.globalLimit;
Expand All @@ -30,7 +29,7 @@ class RESTManager {

getAuth() {
const token = this.client.token ?? this.client.accessToken;
if (token) return `${this.tokenPrefix} ${token}`;
if (token) return `Bot ${token}`;
throw new Error('TOKEN_MISSING');
}

Expand Down

0 comments on commit 9a833b1

Please sign in to comment.