mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
Time Difference in REST (#2057)
This commit is contained in:
@@ -12,12 +12,22 @@ class RESTManager {
|
||||
this.globallyRateLimited = false;
|
||||
this.tokenPrefix = tokenPrefix;
|
||||
this.versioned = true;
|
||||
this.timeDifferences = [];
|
||||
}
|
||||
|
||||
get api() {
|
||||
return routeBuilder(this);
|
||||
}
|
||||
|
||||
get timeDifference() {
|
||||
return Math.round(this.timeDifferences.reduce((a, b) => a + b, 0) / this.timeDifferences.length);
|
||||
}
|
||||
|
||||
set timeDifference(ms) {
|
||||
this.timeDifferences.unshift(ms);
|
||||
if (this.timeDifferences.length > 5) this.timeDifferences.length = 5;
|
||||
}
|
||||
|
||||
getAuth() {
|
||||
const token = this.client.token || this.client.accessToken;
|
||||
const prefixed = !!this.client.application || (this.client.user && this.client.user.bot);
|
||||
|
||||
Reference in New Issue
Block a user