diff --git a/README.md b/README.md index 6a66c5b51..d3c2a5cc8 100644 --- a/README.md +++ b/README.md @@ -18,7 +18,7 @@ ## About -discord.js is a powerful [node.js](https://nodejs.org) module that allows you to interact with the +discord.js is a powerful [Node.js](https://nodejs.org) module that allows you to interact with the [Discord API](https://discordapp.com/developers/docs/intro) very easily. - Object-oriented diff --git a/src/sharding/Shard.js b/src/sharding/Shard.js index 87009e903..7a426f0ad 100644 --- a/src/sharding/Shard.js +++ b/src/sharding/Shard.js @@ -146,9 +146,7 @@ class Shard extends EventEmitter { * @returns {Promise<*>} * @example * shard.fetchClientValue('guilds.size') - * .then(count => { - * console.log(`${count} guilds in shard ${shard.id}`); - * }) + * .then(count => console.log(`${count} guilds in shard ${shard.id}`)) * .catch(console.error); */ fetchClientValue(prop) { diff --git a/src/sharding/ShardClientUtil.js b/src/sharding/ShardClientUtil.js index a73e61b94..5cdfb075b 100644 --- a/src/sharding/ShardClientUtil.js +++ b/src/sharding/ShardClientUtil.js @@ -56,9 +56,7 @@ class ShardClientUtil { * @returns {Promise>} * @example * client.shard.fetchClientValues('guilds.size') - * .then(results => { - * console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`); - * }) + * .then(results => console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`)) * .catch(console.error); * @see {@link ShardingManager#fetchClientValues} */ @@ -82,6 +80,10 @@ class ShardClientUtil { * Evaluates a script or function on all shards, in the context of the {@link Clients}. * @param {string|Function} script JavaScript to run on each shard * @returns {Promise>} Results of the script execution + * @example + * client.shard.broadcastEval('this.guilds.size') + * .then(results => console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`)) + * .catch(console.error); * @see {@link ShardingManager#broadcastEval} */ broadcastEval(script) { diff --git a/src/sharding/ShardingManager.js b/src/sharding/ShardingManager.js index 9596ead2e..5283c9414 100644 --- a/src/sharding/ShardingManager.js +++ b/src/sharding/ShardingManager.js @@ -166,9 +166,7 @@ class ShardingManager extends EventEmitter { * @returns {Promise>} * @example * manager.fetchClientValues('guilds.size') - * .then(results => { - * console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`); - * }) + * .then(results => console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`)) * .catch(console.error); */ fetchClientValues(prop) { diff --git a/src/stores/GuildMemberStore.js b/src/stores/GuildMemberStore.js index 023dc9ba8..e430e28ab 100644 --- a/src/stores/GuildMemberStore.js +++ b/src/stores/GuildMemberStore.js @@ -87,7 +87,7 @@ class GuildMemberStore extends DataStore { * .catch(console.error); * @example * // Fetch by query - * guild.members.fetch({ query: 'hydra' }) + * guild.members.fetch({ query: 'hydra', limit: 1 }) * .then(console.log) * .catch(console.error); */ diff --git a/src/structures/GuildChannel.js b/src/structures/GuildChannel.js index 2e0ee57d0..45e952617 100644 --- a/src/structures/GuildChannel.js +++ b/src/structures/GuildChannel.js @@ -558,8 +558,8 @@ class GuildChannel extends Channel { * @example * // Delete the channel * channel.delete('making room for new channels') - * .then() // Success - * .catch(console.error); // Log error + * .then(console.log) + * .catch(console.error); */ delete(reason) { return this.client.api.channels(this.id).delete({ reason }).then(() => this); diff --git a/src/structures/Webhook.js b/src/structures/Webhook.js index 252812779..50a94bc26 100644 --- a/src/structures/Webhook.js +++ b/src/structures/Webhook.js @@ -125,8 +125,7 @@ class Webhook { * .then(console.log) * .catch(console.error); */ - /* eslint-enable max-len */ - async send(content, options) { // eslint-disable-line complexity + async send(content, options) { if (!options && typeof content === 'object' && !(content instanceof Array)) { options = content; content = null; diff --git a/src/structures/interfaces/TextBasedChannel.js b/src/structures/interfaces/TextBasedChannel.js index a08c85fbe..9659a61c0 100644 --- a/src/structures/interfaces/TextBasedChannel.js +++ b/src/structures/interfaces/TextBasedChannel.js @@ -125,13 +125,12 @@ class TextBasedChannel { * @param {MessageSearchOptions} [options={}] Options to pass to the search * @returns {Promise} * @example - * channel.search({ - * content: 'discord.js', - * before: '2016-11-17' - * }).then(res => { - * const hit = res.results[0].find(m => m.hit).content; - * console.log(`I found: **${hit}**, total results: ${res.total}`); - * }).catch(console.error); + * channel.search({ content: 'discord.js', before: '2016-11-17' }) + * .then(res => { + * const hit = res.results[0].find(m => m.hit).content; + * console.log(`I found: **${hit}**, total results: ${res.total}`); + * }) + * .catch(console.error); */ search(options = {}) { return Shared.search(this, options);