mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-10 08:33:30 +01:00
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:
@@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user