mirror of
https://github.com/danbulant/discord.js
synced 2026-06-07 08:41:29 +00:00
add support for Bot auth in REST
This commit is contained in:
parent
603e231494
commit
0d44a801f2
1 changed files with 4 additions and 1 deletions
|
|
@ -67,7 +67,9 @@ class RESTManager {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (auth) {
|
if (auth) {
|
||||||
if (this.client.store.token) {
|
if (this.client.store.token && this.client.store.user && this.client.store.user.bot) {
|
||||||
|
apiRequest.set('authorization', `Bot ${this.client.store.token}`);
|
||||||
|
} else if (this.client.store.token) {
|
||||||
apiRequest.set('authorization', this.client.store.token);
|
apiRequest.set('authorization', this.client.store.token);
|
||||||
} else {
|
} else {
|
||||||
throw Constants.Errors.NO_TOKEN;
|
throw Constants.Errors.NO_TOKEN;
|
||||||
|
|
@ -99,6 +101,7 @@ class RESTManager {
|
||||||
|
|
||||||
reject(err);
|
reject(err);
|
||||||
} else {
|
} else {
|
||||||
|
console.log(res.headers);
|
||||||
resolve(res ? res.body || {} : {});
|
resolve(res ? res.body || {} : {});
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue