REST API speed improvement (#1577)

This commit is contained in:
Gus Caplan
2017-07-01 04:14:17 -05:00
committed by Amish Shah
parent 6bc7b3e068
commit 5ecd5f7d69
25 changed files with 114 additions and 109 deletions

View File

@@ -57,7 +57,7 @@ class TextChannel extends GuildChannel {
* @returns {Promise<Collection<Snowflake, Webhook>>}
*/
fetchWebhooks() {
return this.client.api.channels(this.id).webhooks.get().then(data => {
return this.client.api.channels[this.id].webhooks.get().then(data => {
const hooks = new Collection();
for (const hook of data) hooks.set(hook.id, new Webhook(this.client, hook));
return hooks;
@@ -76,7 +76,7 @@ class TextChannel extends GuildChannel {
*/
createWebhook(name, avatar) {
if (typeof avatar === 'string' && avatar.startsWith('data:')) {
return this.client.api.channels(this.id).webhooks.post({ data: {
return this.client.api.channels[this.id].webhooks.post({ data: {
name, avatar,
} }).then(data => new Webhook(this.client, data));
} else {