update search to have more useful returns (#1060)

This commit is contained in:
Gus Caplan
2017-01-03 17:49:19 -06:00
committed by Amish Shah
parent 7cbe81e71a
commit d47f9d202b
4 changed files with 14 additions and 8 deletions

View File

@@ -139,9 +139,15 @@ class RESTMethods {
}
const url = `${Constants.Endpoints[`${type}Search`](target.id)}?${queryString}`;
return this.rest.makeRequest('get', url, true).then(body =>
body.messages.map(x => x.map(m => new Message(this.client.channels.get(m.channel_id), m, this.client)))
);
return this.rest.makeRequest('get', url, true).then(body => {
const messages = body.messages.map(x =>
x.map(m => new Message(this.client.channels.get(m.channel_id), m, this.client))
);
return {
totalResults: body.total_results,
messages,
};
});
}
createChannel(guild, channelName, channelType, overwrites) {