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. * 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 * @param {MessageSearchOptions} [options={}] Options to pass to the search
* @returns {Promise<Array<Message[]>>} * @returns {Promise<Array<Message[]>>}
* An array containing arrays of messages. Each inner array is a search context cluster. * 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}`); * console.log(`I found: **${hit}**, total results: ${res.totalResults}`);
* }).catch(console.error); * }).catch(console.error);
*/ */
search(options) { search(options = {}) {
return this.client.rest.methods.search(this, options); return this.client.rest.methods.search(this, options);
} }

View File

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

View File

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