mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
rewrite ratelimiting and api route builder (#1667)
* rewrite ratelimiting and api route builder * more stuff * let people pass their own handlers * Update burst.js * Update RequestHandler.js * Update burst.js * Update sequential.js * Update RequestHandler.js
This commit is contained in:
@@ -332,7 +332,7 @@ class Client extends EventEmitter {
|
||||
*/
|
||||
fetchUser(id, cache = true) {
|
||||
if (this.users.has(id)) return Promise.resolve(this.users.get(id));
|
||||
return this.api.users[id].get().then(data =>
|
||||
return this.api.users(id).get().then(data =>
|
||||
cache ? this.dataManager.newUser(data) : new User(this, data)
|
||||
);
|
||||
}
|
||||
@@ -344,7 +344,7 @@ class Client extends EventEmitter {
|
||||
*/
|
||||
fetchInvite(invite) {
|
||||
const code = this.resolver.resolveInviteCode(invite);
|
||||
return this.api.invites[code].get({ query: { with_counts: true } })
|
||||
return this.api.invites(code).get({ query: { with_counts: true } })
|
||||
.then(data => new Invite(this, data));
|
||||
}
|
||||
|
||||
@@ -355,7 +355,7 @@ class Client extends EventEmitter {
|
||||
* @returns {Promise<Webhook>}
|
||||
*/
|
||||
fetchWebhook(id, token) {
|
||||
return this.api.webhooks.opts(id, token).get().then(data => new Webhook(this, data));
|
||||
return this.api.webhooks(id, token).get().then(data => new Webhook(this, data));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -414,7 +414,7 @@ class Client extends EventEmitter {
|
||||
* @returns {Promise<OAuth2Application>}
|
||||
*/
|
||||
fetchApplication(id = '@me') {
|
||||
return this.api.oauth2.applications[id].get()
|
||||
return this.api.oauth2.applications(id).get()
|
||||
.then(app => new OAuth2Application(this, app));
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user