mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-17 12:03:31 +01:00
Document readonly and private properties (#1338)
This commit is contained in:
@@ -23,6 +23,7 @@ class RequestHandler {
|
|||||||
/**
|
/**
|
||||||
* Whether or not the client is being rate limited on every endpoint.
|
* Whether or not the client is being rate limited on every endpoint.
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get globalLimit() {
|
get globalLimit() {
|
||||||
return this.restManager.globallyRateLimited;
|
return this.restManager.globallyRateLimited;
|
||||||
|
|||||||
@@ -42,6 +42,7 @@ class VoiceBroadcast extends VolumeInterface {
|
|||||||
/**
|
/**
|
||||||
* An array of subscribed dispatchers
|
* An array of subscribed dispatchers
|
||||||
* @type {StreamDispatcher[]}
|
* @type {StreamDispatcher[]}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get dispatchers() {
|
get dispatchers() {
|
||||||
let d = [];
|
let d = [];
|
||||||
|
|||||||
@@ -55,6 +55,7 @@ class StreamDispatcher extends VolumeInterface {
|
|||||||
* How many passes the dispatcher should take when sending packets to reduce packet loss. Values over 5
|
* How many passes the dispatcher should take when sending packets to reduce packet loss. Values over 5
|
||||||
* aren't recommended, as it means you are using 5x more bandwidth. You _can_ edit this at runtime.
|
* aren't recommended, as it means you are using 5x more bandwidth. You _can_ edit this at runtime.
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get passes() {
|
get passes() {
|
||||||
return this.streamOptions.passes || 1;
|
return this.streamOptions.passes || 1;
|
||||||
|
|||||||
@@ -53,6 +53,7 @@ class AudioPlayer extends EventEmitter {
|
|||||||
/**
|
/**
|
||||||
* The current dispatcher
|
* The current dispatcher
|
||||||
* @type {?StreamDispatcher}
|
* @type {?StreamDispatcher}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get currentDispatcher() {
|
get currentDispatcher() {
|
||||||
return this.streams.size > 0 ? this.streams.last().dispatcher || null : null;
|
return this.streams.size > 0 ? this.streams.last().dispatcher || null : null;
|
||||||
|
|||||||
@@ -306,6 +306,7 @@ class Guild {
|
|||||||
* Fetches a collection of roles in the current guild sorted by position.
|
* Fetches a collection of roles in the current guild sorted by position.
|
||||||
* @type {Collection<Snowflake, Role>}
|
* @type {Collection<Snowflake, Role>}
|
||||||
* @readonly
|
* @readonly
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
get _sortedRoles() {
|
get _sortedRoles() {
|
||||||
return this._sortPositionWithID(this.roles);
|
return this._sortPositionWithID(this.roles);
|
||||||
@@ -963,6 +964,7 @@ class Guild {
|
|||||||
* Fetches a collection of channels in the current guild sorted by position.
|
* Fetches a collection of channels in the current guild sorted by position.
|
||||||
* @param {string} type Channel type
|
* @param {string} type Channel type
|
||||||
* @returns {Collection<Snowflake, GuildChannel>}
|
* @returns {Collection<Snowflake, GuildChannel>}
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
_sortedChannels(type) {
|
_sortedChannels(type) {
|
||||||
return this._sortPositionWithID(this.channels.filter(c => {
|
return this._sortPositionWithID(this.channels.filter(c => {
|
||||||
@@ -977,6 +979,7 @@ class Guild {
|
|||||||
* Intended to be identical to Discord's sorting method.
|
* Intended to be identical to Discord's sorting method.
|
||||||
* @param {Collection} collection The collection to sort
|
* @param {Collection} collection The collection to sort
|
||||||
* @returns {Collection}
|
* @returns {Collection}
|
||||||
|
* @private
|
||||||
*/
|
*/
|
||||||
_sortPositionWithID(collection) {
|
_sortPositionWithID(collection) {
|
||||||
return collection.sort((a, b) =>
|
return collection.sort((a, b) =>
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ class GuildChannel extends Channel {
|
|||||||
/**
|
/**
|
||||||
* The position of the channel
|
* The position of the channel
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get calculatedPosition() {
|
get calculatedPosition() {
|
||||||
const sorted = this.guild._sortedChannels(this.type);
|
const sorted = this.guild._sortedChannels(this.type);
|
||||||
|
|||||||
@@ -105,6 +105,7 @@ class MessageEmbed {
|
|||||||
/**
|
/**
|
||||||
* The date this embed was created
|
* The date this embed was created
|
||||||
* @type {Date}
|
* @type {Date}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get createdAt() {
|
get createdAt() {
|
||||||
return new Date(this.createdTimestamp);
|
return new Date(this.createdTimestamp);
|
||||||
|
|||||||
@@ -39,6 +39,7 @@ class MessageReaction {
|
|||||||
* object which has fewer properties. Whatever the prototype of the emoji, it will still have
|
* object which has fewer properties. Whatever the prototype of the emoji, it will still have
|
||||||
* `name`, `id`, `identifier` and `toString()`
|
* `name`, `id`, `identifier` and `toString()`
|
||||||
* @type {Emoji|ReactionEmoji}
|
* @type {Emoji|ReactionEmoji}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get emoji() {
|
get emoji() {
|
||||||
if (this._emoji instanceof Emoji) return this._emoji;
|
if (this._emoji instanceof Emoji) return this._emoji;
|
||||||
|
|||||||
@@ -126,6 +126,7 @@ class Role {
|
|||||||
/**
|
/**
|
||||||
* The position of the role in the role manager
|
* The position of the role in the role manager
|
||||||
* @type {number}
|
* @type {number}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get calculatedPosition() {
|
get calculatedPosition() {
|
||||||
const sorted = this.guild._sortedRoles;
|
const sorted = this.guild._sortedRoles;
|
||||||
|
|||||||
@@ -175,6 +175,7 @@ class User {
|
|||||||
/**
|
/**
|
||||||
* The DM between the client's user and this user
|
* The DM between the client's user and this user
|
||||||
* @type {?DMChannel}
|
* @type {?DMChannel}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get dmChannel() {
|
get dmChannel() {
|
||||||
return this.client.channels.filter(c => c.type === 'dm').find(c => c.recipient.id === this.id);
|
return this.client.channels.filter(c => c.type === 'dm').find(c => c.recipient.id === this.id);
|
||||||
|
|||||||
@@ -48,6 +48,7 @@ class VoiceChannel extends GuildChannel {
|
|||||||
/**
|
/**
|
||||||
* Checks if the voice channel is full
|
* Checks if the voice channel is full
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get full() {
|
get full() {
|
||||||
return this.userLimit > 0 && this.members.size >= this.userLimit;
|
return this.userLimit > 0 && this.members.size >= this.userLimit;
|
||||||
@@ -56,6 +57,7 @@ class VoiceChannel extends GuildChannel {
|
|||||||
/**
|
/**
|
||||||
* Checks if the client has permission join the voice channel
|
* Checks if the client has permission join the voice channel
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get joinable() {
|
get joinable() {
|
||||||
if (this.client.browser) return false;
|
if (this.client.browser) return false;
|
||||||
@@ -67,6 +69,7 @@ class VoiceChannel extends GuildChannel {
|
|||||||
/**
|
/**
|
||||||
* Checks if the client has permission to send audio to the voice channel
|
* Checks if the client has permission to send audio to the voice channel
|
||||||
* @type {boolean}
|
* @type {boolean}
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get speakable() {
|
get speakable() {
|
||||||
return this.permissionsFor(this.client.user).hasPermission('SPEAK');
|
return this.permissionsFor(this.client.user).hasPermission('SPEAK');
|
||||||
|
|||||||
@@ -32,6 +32,7 @@ class Permissions {
|
|||||||
* @type {number}
|
* @type {number}
|
||||||
* @see {@link Permissions#bitfield}
|
* @see {@link Permissions#bitfield}
|
||||||
* @deprecated
|
* @deprecated
|
||||||
|
* @readonly
|
||||||
*/
|
*/
|
||||||
get raw() {
|
get raw() {
|
||||||
return this.bitfield;
|
return this.bitfield;
|
||||||
|
|||||||
Reference in New Issue
Block a user