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:
Crawl
2017-07-27 03:04:03 +02:00
parent 07178a0a2a
commit 4adecf4aef
20 changed files with 187 additions and 316 deletions

View File

@@ -153,7 +153,7 @@ class Webhook {
file.file = buffer;
return file;
})
)).then(files => this.client.api.webhooks.opts(this.id, this.token).post({
)).then(files => this.client.api.webhooks(this.id, this.token).post({
data: options,
query: { wait: true },
files,
@@ -161,7 +161,7 @@ class Webhook {
}));
}
return this.client.api.webhooks.opts(this.id, this.token).post({
return this.client.api.webhooks(this.id, this.token).post({
data: options,
query: { wait: true },
auth: false,
@@ -190,7 +190,7 @@ class Webhook {
* }).catch(console.error);
*/
sendSlackMessage(body) {
return this.client.api.webhooks.opts(this.id, this.token).slack.post({
return this.client.api.webhooks(this.id, this.token).slack.post({
query: { wait: true },
auth: false,
data: body,
@@ -216,7 +216,7 @@ class Webhook {
return this.edit({ name, avatar: dataURI }, reason);
});
}
return this.client.api.webhooks.opts(this.id, this.token).patch({
return this.client.api.webhooks(this.id, this.token).patch({
data: { name, avatar },
reason,
}).then(data => {
@@ -232,7 +232,7 @@ class Webhook {
* @returns {Promise}
*/
delete(reason) {
return this.client.api.webhooks.opts(this.id, this.token).delete({ reason });
return this.client.api.webhooks(this.id, this.token).delete({ reason });
}
}