mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-19 13:03:31 +01:00
docs: consistency
This commit is contained in:
@@ -18,7 +18,7 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
## About
|
## 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.
|
[Discord API](https://discordapp.com/developers/docs/intro) very easily.
|
||||||
|
|
||||||
- Object-oriented
|
- Object-oriented
|
||||||
|
|||||||
@@ -146,9 +146,7 @@ class Shard extends EventEmitter {
|
|||||||
* @returns {Promise<*>}
|
* @returns {Promise<*>}
|
||||||
* @example
|
* @example
|
||||||
* shard.fetchClientValue('guilds.size')
|
* shard.fetchClientValue('guilds.size')
|
||||||
* .then(count => {
|
* .then(count => console.log(`${count} guilds in shard ${shard.id}`))
|
||||||
* console.log(`${count} guilds in shard ${shard.id}`);
|
|
||||||
* })
|
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
fetchClientValue(prop) {
|
fetchClientValue(prop) {
|
||||||
|
|||||||
@@ -56,9 +56,7 @@ class ShardClientUtil {
|
|||||||
* @returns {Promise<Array<*>>}
|
* @returns {Promise<Array<*>>}
|
||||||
* @example
|
* @example
|
||||||
* client.shard.fetchClientValues('guilds.size')
|
* client.shard.fetchClientValues('guilds.size')
|
||||||
* .then(results => {
|
* .then(results => console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`))
|
||||||
* console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`);
|
|
||||||
* })
|
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
* @see {@link ShardingManager#fetchClientValues}
|
* @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}.
|
* 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
|
* @param {string|Function} script JavaScript to run on each shard
|
||||||
* @returns {Promise<Array<*>>} Results of the script execution
|
* @returns {Promise<Array<*>>} 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}
|
* @see {@link ShardingManager#broadcastEval}
|
||||||
*/
|
*/
|
||||||
broadcastEval(script) {
|
broadcastEval(script) {
|
||||||
|
|||||||
@@ -166,9 +166,7 @@ class ShardingManager extends EventEmitter {
|
|||||||
* @returns {Promise<Array<*>>}
|
* @returns {Promise<Array<*>>}
|
||||||
* @example
|
* @example
|
||||||
* manager.fetchClientValues('guilds.size')
|
* manager.fetchClientValues('guilds.size')
|
||||||
* .then(results => {
|
* .then(results => console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`))
|
||||||
* console.log(`${results.reduce((prev, val) => prev + val, 0)} total guilds`);
|
|
||||||
* })
|
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
fetchClientValues(prop) {
|
fetchClientValues(prop) {
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ class GuildMemberStore extends DataStore {
|
|||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
* @example
|
* @example
|
||||||
* // Fetch by query
|
* // Fetch by query
|
||||||
* guild.members.fetch({ query: 'hydra' })
|
* guild.members.fetch({ query: 'hydra', limit: 1 })
|
||||||
* .then(console.log)
|
* .then(console.log)
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -558,8 +558,8 @@ class GuildChannel extends Channel {
|
|||||||
* @example
|
* @example
|
||||||
* // Delete the channel
|
* // Delete the channel
|
||||||
* channel.delete('making room for new channels')
|
* channel.delete('making room for new channels')
|
||||||
* .then() // Success
|
* .then(console.log)
|
||||||
* .catch(console.error); // Log error
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
delete(reason) {
|
delete(reason) {
|
||||||
return this.client.api.channels(this.id).delete({ reason }).then(() => this);
|
return this.client.api.channels(this.id).delete({ reason }).then(() => this);
|
||||||
|
|||||||
@@ -125,8 +125,7 @@ class Webhook {
|
|||||||
* .then(console.log)
|
* .then(console.log)
|
||||||
* .catch(console.error);
|
* .catch(console.error);
|
||||||
*/
|
*/
|
||||||
/* eslint-enable max-len */
|
async send(content, options) {
|
||||||
async send(content, options) { // eslint-disable-line complexity
|
|
||||||
if (!options && typeof content === 'object' && !(content instanceof Array)) {
|
if (!options && typeof content === 'object' && !(content instanceof Array)) {
|
||||||
options = content;
|
options = content;
|
||||||
content = null;
|
content = null;
|
||||||
|
|||||||
@@ -125,13 +125,12 @@ class TextBasedChannel {
|
|||||||
* @param {MessageSearchOptions} [options={}] Options to pass to the search
|
* @param {MessageSearchOptions} [options={}] Options to pass to the search
|
||||||
* @returns {Promise<MessageSearchResult>}
|
* @returns {Promise<MessageSearchResult>}
|
||||||
* @example
|
* @example
|
||||||
* channel.search({
|
* channel.search({ content: 'discord.js', before: '2016-11-17' })
|
||||||
* content: 'discord.js',
|
* .then(res => {
|
||||||
* before: '2016-11-17'
|
* const hit = res.results[0].find(m => m.hit).content;
|
||||||
* }).then(res => {
|
* console.log(`I found: **${hit}**, total results: ${res.total}`);
|
||||||
* const hit = res.results[0].find(m => m.hit).content;
|
* })
|
||||||
* console.log(`I found: **${hit}**, total results: ${res.total}`);
|
* .catch(console.error);
|
||||||
* }).catch(console.error);
|
|
||||||
*/
|
*/
|
||||||
search(options = {}) {
|
search(options = {}) {
|
||||||
return Shared.search(this, options);
|
return Shared.search(this, options);
|
||||||
|
|||||||
Reference in New Issue
Block a user