Made search argument optional, added useronly warning and fixed endpoint (#1407)

This commit is contained in:
SpaceEEC
2017-04-24 14:31:39 +02:00
committed by Crawl
parent aec0a095e3
commit 401822a094
3 changed files with 5 additions and 3 deletions

View File

@@ -444,6 +444,7 @@ class Guild {
/**
* Performs a search within the entire guild.
* <warn>This is only available when using a user account.</warn>
* @param {MessageSearchOptions} [options={}] Options to pass to the search
* @returns {Promise<Array<Message[]>>}
* An array containing arrays of messages. Each inner array is a search context cluster.
@@ -457,7 +458,7 @@ class Guild {
* console.log(`I found: **${hit}**, total results: ${res.totalResults}`);
* }).catch(console.error);
*/
search(options) {
search(options = {}) {
return this.client.rest.methods.search(this, options);
}

View File

@@ -218,6 +218,7 @@ class TextBasedChannel {
/**
* Performs a search within the channel.
* <warn>This is only available when using a user account.</warn>
* @param {MessageSearchOptions} [options={}] Options to pass to the search
* @returns {Promise<Array<Message[]>>}
* An array containing arrays of messages. Each inner array is a search context cluster.
@@ -231,7 +232,7 @@ class TextBasedChannel {
* console.log(`I found: **${hit}**, total results: ${res.totalResults}`);
* }).catch(console.error);
*/
search(options) {
search(options = {}) {
return this.client.rest.methods.search(this, options);
}

View File

@@ -154,7 +154,7 @@ const Endpoints = exports.Endpoints = {
typing: `${base}/typing`,
permissions: `${base}/permissions`,
webhooks: `${base}/webhooks`,
search: `${base}/search`,
search: `${base}/messages/search`,
ack: `${base}/ack`,
pins: `${base}/pins`,
Pin: messageID => `${base}/pins/${messageID}`,