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:
Gus Caplan
2017-07-20 19:32:40 -05:00
committed by Crawl
parent 11556c0b3b
commit a2eeafc75d
20 changed files with 187 additions and 316 deletions

View File

@@ -91,7 +91,7 @@ class ClientUser extends User {
if (data.new_password) _data.new_password = data.newPassword;
}
return this.client.api.users['@me'].patch({ data })
return this.client.api.users('@me').patch({ data })
.then(newData => this.client.actions.UserUpdate.handle(newData).updated);
}
@@ -284,7 +284,7 @@ class ClientUser extends User {
if (options.guild instanceof Guild) options.guild = options.guild.id;
Util.mergeDefault({ limit: 25, roles: true, everyone: true, guild: null }, options);
return this.client.api.users['@me'].mentions.get({ query: options })
return this.client.api.users('@me').mentions.get({ query: options })
.then(data => data.map(m => new Message(this.client.channels.get(m.channel_id), m, this.client)));
}
@@ -351,7 +351,7 @@ class ClientUser extends User {
return o;
}, {}),
} : { recipients: recipients.map(u => this.client.resolver.resolveUserID(u)) };
return this.client.api.users['@me'].channels.post({ data })
return this.client.api.users('@me').channels.post({ data })
.then(res => new GroupDMChannel(this.client, res));
}
}