From eb591dafbaf1f91a4df90c6001cb0ff343beda07 Mon Sep 17 00:00:00 2001 From: Frangu Vlad Date: Thu, 21 Sep 2017 08:02:47 +0300 Subject: [PATCH] docs: Fix some small typos or "missing" docs (#1943) * Fix documentation for GuildAuditLogEntry.target * Update documentation for CategoryChannel#children * Add EntryTarget for audit logs I've done this to "fulfill" devsneks request while also showing all the possible results for the target of an AuditLogEntry * Oops Eslint * Private timeout sets gets set by BaseClient not WebhookClient * Fix the "Missing Docs" for Presence#activity * Small doc inconsistency Array instead of Array for Activity * Client#emojis is an EmojiStore not a Collection * Document ClientPresenceStore Just so its clickable through the wiki, nothing else is documented * Small fix for BaseClient#setInterval You don't wait before executing, you execute every X ms * GuildChannelResolvable takes a GuildChannel/Snowflake * Typo in UserResolvable * Another typo for UserResolvable * Add the number to the Status and VoiceStatus docs Its probably not needed, but just so the user knows what each number means, its now documented. --- src/client/BaseClient.js | 6 +++--- src/client/Client.js | 2 +- src/stores/ClientPresenceStore.js | 5 +++++ src/stores/GuildChannelStore.js | 4 ++-- src/stores/GuildMemberStore.js | 2 +- src/stores/PresenceStore.js | 4 ++-- src/structures/CategoryChannel.js | 2 +- src/structures/GuildAuditLogs.js | 14 +++++++++++++- src/structures/Presence.js | 3 ++- src/util/Constants.js | 22 +++++++++++----------- 10 files changed, 41 insertions(+), 23 deletions(-) diff --git a/src/client/BaseClient.js b/src/client/BaseClient.js index 4cd53bb05..7be9530fa 100644 --- a/src/client/BaseClient.js +++ b/src/client/BaseClient.js @@ -25,14 +25,14 @@ class BaseClient extends EventEmitter { this.rest = new RESTManager(this, options._tokenType); /** - * Timeouts set by {@link WebhookClient#setTimeout} that are still active + * Timeouts set by {@link BaseClient#setTimeout} that are still active * @type {Set} * @private */ this._timeouts = new Set(); /** - * Intervals set by {@link WebhookClient#setInterval} that are still active + * Intervals set by {@link BaseClient#setInterval} that are still active * @type {Set} * @private */ @@ -95,7 +95,7 @@ class BaseClient extends EventEmitter { /** * Sets an interval that will be automatically cancelled if the client is destroyed. * @param {Function} fn Function to execute - * @param {number} delay Time to wait before executing (in milliseconds) + * @param {number} delay Time to wait between executions (in milliseconds) * @param {...*} args Arguments for the function * @returns {Timeout} */ diff --git a/src/client/Client.js b/src/client/Client.js index 33a67633f..ce7539a83 100644 --- a/src/client/Client.js +++ b/src/client/Client.js @@ -213,7 +213,7 @@ class Client extends BaseClient { /** * All custom emojis that the client has access to, mapped by their IDs - * @type {Collection} + * @type {EmojiStore} * @readonly */ get emojis() { diff --git a/src/stores/ClientPresenceStore.js b/src/stores/ClientPresenceStore.js index cc17fe33d..12213059c 100644 --- a/src/stores/ClientPresenceStore.js +++ b/src/stores/ClientPresenceStore.js @@ -4,6 +4,11 @@ const { ActivityTypes, OPCodes } = require('../util/Constants'); const { Presence } = require('../structures/Presence'); const { TypeError } = require('../errors'); +/** + * Stores the client presence and other presences. + * @extends {PresenceStore} + * @private + */ class ClientPresenceStore extends PresenceStore { constructor(...args) { super(...args); diff --git a/src/stores/GuildChannelStore.js b/src/stores/GuildChannelStore.js index 21e179e97..3e03c8110 100644 --- a/src/stores/GuildChannelStore.js +++ b/src/stores/GuildChannelStore.js @@ -21,10 +21,10 @@ class GuildChannelStore extends DataStore { } /** - * Data that can be resolved to give a Channel object. This can be: + * Data that can be resolved to give a Guild Channel object. This can be: * * A GuildChannel object * * A Snowflake - * @typedef {Channel|Snowflake} GuildChannelResolvable + * @typedef {GuildChannel|Snowflake} GuildChannelResolvable */ /** diff --git a/src/stores/GuildMemberStore.js b/src/stores/GuildMemberStore.js index 38a7a9440..2a52e3fe2 100644 --- a/src/stores/GuildMemberStore.js +++ b/src/stores/GuildMemberStore.js @@ -22,7 +22,7 @@ class GuildMemberStore extends DataStore { * Data that resolves to give a GuildMember object. This can be: * * A GuildMember object * * A User resolvable - * @typedef {GuildMember|UserResolveable} GuildMemberResolvable + * @typedef {GuildMember|UserResolvable} GuildMemberResolvable */ /** diff --git a/src/stores/PresenceStore.js b/src/stores/PresenceStore.js index c47cd4b98..1c2649712 100644 --- a/src/stores/PresenceStore.js +++ b/src/stores/PresenceStore.js @@ -19,9 +19,9 @@ class PresenceStore extends DataStore { /** * Data that can be resolved to a Presence object. This can be: * * A Presence - * * A UserResolveable + * * A UserResolvable * * A Snowflake - * @typedef {Presence|UserResolveable|Snowflake} PresenceResolvable + * @typedef {Presence|UserResolvable|Snowflake} PresenceResolvable */ /** diff --git a/src/structures/CategoryChannel.js b/src/structures/CategoryChannel.js index dd53e1d79..2c063f73d 100644 --- a/src/structures/CategoryChannel.js +++ b/src/structures/CategoryChannel.js @@ -7,7 +7,7 @@ const GuildChannel = require('./GuildChannel'); class CategoryChannel extends GuildChannel { /** * The channels that are part of this category - * @type {?Collection} + * @type {?Collection} * @readonly */ get children() { diff --git a/src/structures/GuildAuditLogs.js b/src/structures/GuildAuditLogs.js index 1c077af5f..f25edddc6 100644 --- a/src/structures/GuildAuditLogs.js +++ b/src/structures/GuildAuditLogs.js @@ -97,6 +97,18 @@ class GuildAuditLogs { * @typedef {string} TargetType */ + /** + * The target for an audit log entry. It can be one of: + * * A guild + * * A user + * * A role + * * An emoji + * * An invite + * * A webhook + * * An object where the keys represent either the new value or the old value + * @typedef {?Object|Guild|User|Role|Emoji|Invite|Webhook} EntryTarget + */ + /** * Find target type from entry action. * @param {number} target The action target @@ -259,7 +271,7 @@ class GuildAuditLogsEntry { if (targetType === Targets.UNKNOWN) { /** * The target of this entry - * @type {TargetType} + * @type {EntryTarget} */ this.target = this.changes.reduce((o, c) => { o[c.key] = c.new || c.old; diff --git a/src/structures/Presence.js b/src/structures/Presence.js index 41a7af54e..d5bf2c4ae 100644 --- a/src/structures/Presence.js +++ b/src/structures/Presence.js @@ -23,6 +23,7 @@ class Presence { const activity = data.game || data.activity; /** + * The activity of the presence * @type {?Activity} */ this.activity = activity ? new Activity(this, activity) : null; @@ -108,7 +109,7 @@ class Activity { * Party of the activity * @type {?Object} * @prop {?string} id ID of the party - * @prop {Number[]} size Size of the party as `[current, max]` + * @prop {number[]} size Size of the party as `[current, max]` */ this.party = data.party || null; diff --git a/src/util/Constants.js b/src/util/Constants.js index a88af9f5b..3d9065309 100644 --- a/src/util/Constants.js +++ b/src/util/Constants.js @@ -131,12 +131,12 @@ exports.Endpoints = { /** * The current status of the client. Here are the available statuses: - * * READY - * * CONNECTING - * * RECONNECTING - * * IDLE - * * NEARLY - * * DISCONNECTED + * * READY: 0 + * * CONNECTING: 1 + * * RECONNECTING: 2 + * * IDLE: 3 + * * NEARLY: 4 + * * DISCONNECTED: 5 * @typedef {number} Status */ exports.Status = { @@ -150,11 +150,11 @@ exports.Status = { /** * The current status of a voice connection. Here are the available statuses: - * * CONNECTED - * * CONNECTING - * * AUTHENTICATING - * * RECONNECTING - * * DISCONNECTED + * * CONNECTED: 0 + * * CONNECTING: 1 + * * AUTHENTICATING: 2 + * * RECONNECTING: 3 + * * DISCONNECTED: 4 * @typedef {number} VoiceStatus */ exports.VoiceStatus = {