add more search stuff (#1046)

* add more search stuff

* clean up the options

* fix link hostname

* use some resolvers

* fix type
This commit is contained in:
Gus Caplan
2016-12-30 11:14:31 -06:00
committed by Amish Shah
parent 258e4b9085
commit da32c2ec3d
4 changed files with 113 additions and 242 deletions

View File

@@ -1,10 +1,8 @@
const path = require('path');
const Message = require('../Message');
const MessageCollector = require('../MessageCollector');
const MessageSearch = require('../MessageSearch');
const Collection = require('../../util/Collection');
/**
* Interface for classes that have text-channel-like features
* @interface
@@ -218,20 +216,22 @@ class TextBasedChannel {
/**
* Performs a search
* @param {MessageSearchOptions} [options={}] Options to pass to the search
* @returns {MessageSearch}
* @returns {Promise<Array<Message[]>>}
* An array containing arrays of messages. Each inner array is a search context cluster.
* The message which has triggered the result will have the `hit` property set to `true`.
* @example
* channel.search()
* .content('discord.js')
* .before('2016-11-17')
* .execute()
* .then(res => {
* const hit = res[0].find(m => m.hit).content;
* console.log(`I found: **${hit}**`);
* })
* .catch(console.error);
* channel.search({
* content: 'discord.js',
* before: '2016-11-17'
* })
* .then(res => {
* const hit = res[0].find(m => m.hit).content;
* console.log(`I found: **${hit}**`);
* })
* .catch(console.error);
*/
search(options) {
return new MessageSearch(this, options);
return this.client.rest.methods.search(this, options);
}
/**