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<Number> instead of Array<number> 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.
This commit is contained in:
Frangu Vlad
2017-09-21 08:02:47 +03:00
committed by Crawl
parent f2502e29b9
commit eb591dafba
10 changed files with 41 additions and 23 deletions

View File

@@ -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<Timeout>}
* @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<Timeout>}
* @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}
*/

View File

@@ -213,7 +213,7 @@ class Client extends BaseClient {
/**
* All custom emojis that the client has access to, mapped by their IDs
* @type {Collection<Snowflake, Emoji>}
* @type {EmojiStore<Snowflake, Emoji>}
* @readonly
*/
get emojis() {

View File

@@ -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);

View File

@@ -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
*/
/**

View File

@@ -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
*/
/**

View File

@@ -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
*/
/**

View File

@@ -7,7 +7,7 @@ const GuildChannel = require('./GuildChannel');
class CategoryChannel extends GuildChannel {
/**
* The channels that are part of this category
* @type {?Collection}
* @type {?Collection<Snowflake, GuildChannel>}
* @readonly
*/
get children() {

View File

@@ -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;

View File

@@ -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;

View File

@@ -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 = {