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

@@ -188,7 +188,7 @@ class GuildChannel extends Channel {
}
}
return this.client.api.channels(this.id).permissions(payload.id)
return this.client.api.channels[this.id].permissions(payload.id)
.put({ data: payload, reason })
.then(() => this);
}
@@ -215,7 +215,7 @@ class GuildChannel extends Channel {
* .catch(console.error);
*/
edit(data, reason) {
return this.client.api.channels(this.id).patch({
return this.client.api.channels[this.id].patch({
data: {
name: (data.name || this.name).trim(),
topic: data.topic || this.topic,
@@ -287,7 +287,7 @@ class GuildChannel extends Channel {
* @returns {Promise<Invite>}
*/
createInvite({ temporary = false, maxAge = 86400, maxUses = 0, reason } = {}) {
return this.client.api.channels(this.id).invites.post({ data: {
return this.client.api.channels[this.id].invites.post({ data: {
temporary, max_age: maxAge, max_uses: maxUses,
}, reason })
.then(invite => new Invite(this.client, invite));
@@ -351,7 +351,7 @@ class GuildChannel extends Channel {
* .catch(console.error); // Log error
*/
delete(reason) {
return this.client.api.channels(this.id).delete({ reason }).then(() => this);
return this.client.api.channels[this.id].delete({ reason }).then(() => this);
}
/**