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

@@ -63,8 +63,8 @@ class MessageReaction {
remove(user = this.message.client.user) {
const userID = this.message.client.resolver.resolveUserID(user);
if (!userID) return Promise.reject(new Error('Couldn\'t resolve the user ID to remove from the reaction.'));
return this.message.client.api.channels(this.message.channel.id).messages(this.message.id)
.reactions(this.emoji.identifier)[userID === this.message.client.user.id ? '@me' : userID]
return this.message.client.api.channels[this.message.channel.id].messages[this.message.id]
.reactions[this.emoji.identifier][userID === this.message.client.user.id ? '@me' : userID]
.delete()
.then(() =>
this.message.client.actions.MessageReactionRemove.handle({
@@ -83,8 +83,8 @@ class MessageReaction {
*/
fetchUsers(limit = 100) {
const message = this.message;
return message.client.api.channels(message.channel.id).messages(message.id)
.reactions(this.emoji.identifier)
return message.client.api.channels[message.channel.id].messages[message.id]
.reactions[this.emoji.identifier]
.get({ query: { limit } })
.then(users => {
this.users = new Collection();