docs: mark getters as @ readonly

This commit is contained in:
SpaceEEC
2019-03-19 19:59:45 +01:00
parent df1889ab49
commit e62833b5e1
15 changed files with 27 additions and 4 deletions

View File

@@ -34,6 +34,7 @@ class VoiceBroadcast extends EventEmitter {
/** /**
* The current master dispatcher, if any. This dispatcher controls all that is played by subscribed dispatchers. * The current master dispatcher, if any. This dispatcher controls all that is played by subscribed dispatchers.
* @type {?BroadcastDispatcher} * @type {?BroadcastDispatcher}
* @readonly
*/ */
get dispatcher() { get dispatcher() {
return this.player.dispatcher; return this.player.dispatcher;

View File

@@ -130,6 +130,7 @@ class VoiceConnection extends EventEmitter {
/** /**
* The client that instantiated this connection * The client that instantiated this connection
* @type {Client} * @type {Client}
* @readonly
*/ */
get client() { get client() {
return this.voiceManager.client; return this.voiceManager.client;

View File

@@ -146,12 +146,14 @@ class StreamDispatcher extends Writable {
/** /**
* Whether or not playback is paused * Whether or not playback is paused
* @type {boolean} * @type {boolean}
* @readonly
*/ */
get paused() { return Boolean(this.pausedSince); } get paused() { return Boolean(this.pausedSince); }
/** /**
* Total time that this dispatcher has been paused * Total time that this dispatcher has been paused
* @type {number} * @type {number}
* @readonly
*/ */
get pausedTime() { get pausedTime() {
return this._silentPausedTime + this._pausedTime + (this.paused ? Date.now() - this.pausedSince : 0); return this._silentPausedTime + this._pausedTime + (this.paused ? Date.now() - this.pausedSince : 0);
@@ -177,6 +179,7 @@ class StreamDispatcher extends Writable {
/** /**
* The time (in milliseconds) that the dispatcher has actually been playing audio for * The time (in milliseconds) that the dispatcher has actually been playing audio for
* @type {number} * @type {number}
* @readonly
*/ */
get streamTime() { get streamTime() {
return this.count * FRAME_LENGTH; return this.count * FRAME_LENGTH;
@@ -185,6 +188,7 @@ class StreamDispatcher extends Writable {
/** /**
* The time (in milliseconds) that the dispatcher has been playing audio for, taking into account skips and pauses * The time (in milliseconds) that the dispatcher has been playing audio for, taking into account skips and pauses
* @type {number} * @type {number}
* @readonly
*/ */
get totalStreamTime() { get totalStreamTime() {
return Date.now() - this.startTime; return Date.now() - this.startTime;
@@ -322,6 +326,7 @@ class StreamDispatcher extends Writable {
/** /**
* Whether or not the Opus bitrate of this stream is editable * Whether or not the Opus bitrate of this stream is editable
* @type {boolean} * @type {boolean}
* @readonly
*/ */
get bitrateEditable() { return this.streams.opus && this.streams.opus.setBitrate; } get bitrateEditable() { return this.streams.opus && this.streams.opus.setBitrate; }

View File

@@ -32,6 +32,7 @@ class VoiceWebSocket extends EventEmitter {
/** /**
* The client of this voice WebSocket * The client of this voice WebSocket
* @type {Client} * @type {Client}
* @readonly
*/ */
get client() { get client() {
return this.connection.voiceManager.client; return this.connection.voiceManager.client;

View File

@@ -15,6 +15,7 @@ class VolumeInterface extends EventEmitter {
/** /**
* Whether or not the volume of this stream is editable * Whether or not the volume of this stream is editable
* @type {boolean} * @type {boolean}
* @readonly
*/ */
get volumeEditable() { get volumeEditable() {
return true; return true;
@@ -22,8 +23,8 @@ class VolumeInterface extends EventEmitter {
/** /**
* The current volume of the stream * The current volume of the stream
* @readonly
* @type {number} * @type {number}
* @readonly
*/ */
get volume() { get volume() {
return this._volume; return this._volume;
@@ -31,8 +32,8 @@ class VolumeInterface extends EventEmitter {
/** /**
* The current volume of the stream in decibels * The current volume of the stream in decibels
* @readonly
* @type {number} * @type {number}
* @readonly
*/ */
get volumeDecibels() { get volumeDecibels() {
return Math.log10(this.volume) * 20; return Math.log10(this.volume) * 20;
@@ -40,8 +41,8 @@ class VolumeInterface extends EventEmitter {
/** /**
* The current volume of the stream from a logarithmic scale * The current volume of the stream from a logarithmic scale
* @readonly
* @type {number} * @type {number}
* @readonly
*/ */
get volumeLogarithmic() { get volumeLogarithmic() {
return Math.pow(this.volume, 1 / 1.660964); return Math.pow(this.volume, 1 / 1.660964);

View File

@@ -20,6 +20,7 @@ class GuildEmojiRoleStore extends Collection {
* The filtered collection of roles of the guild emoji * The filtered collection of roles of the guild emoji
* @type {Collection<Snowflake, Role>} * @type {Collection<Snowflake, Role>}
* @private * @private
* @readonly
*/ */
get _filtered() { get _filtered() {
return this.guild.roles.filter(role => this.emoji._roles.includes(role.id)); return this.guild.roles.filter(role => this.emoji._roles.includes(role.id));

View File

@@ -20,6 +20,7 @@ class GuildMemberRoleStore extends Collection {
* The filtered collection of roles of the member * The filtered collection of roles of the member
* @type {Collection<Snowflake, Role>} * @type {Collection<Snowflake, Role>}
* @private * @private
* @readonly
*/ */
get _filtered() { get _filtered() {
const everyone = this.guild.defaultRole; const everyone = this.guild.defaultRole;

View File

@@ -30,8 +30,8 @@ class ClientUser extends Structures.get('User') {
/** /**
* ClientUser's presence * ClientUser's presence
* @readonly
* @type {Presence} * @type {Presence}
* @readonly
*/ */
get presence() { get presence() {
return this.client.presence; return this.client.presence;

View File

@@ -49,6 +49,7 @@ class DMChannel extends Channel {
/** /**
* Whether this DMChannel is a partial * Whether this DMChannel is a partial
* @type {boolean} * @type {boolean}
* @readonly
*/ */
get partial() { get partial() {
return !this.recipient; return !this.recipient;

View File

@@ -83,6 +83,7 @@ class GuildMember extends Base {
/** /**
* Whether this GuildMember is a partial * Whether this GuildMember is a partial
* @type {boolean} * @type {boolean}
* @readonly
*/ */
get partial() { get partial() {
return !this.joinedTimestamp; return !this.joinedTimestamp;

View File

@@ -172,6 +172,7 @@ class Message extends Base {
/** /**
* Whether or not this message is a partial * Whether or not this message is a partial
* @type {boolean} * @type {boolean}
* @readonly
*/ */
get partial() { get partial() {
return typeof this.content !== 'string' || !this.author; return typeof this.content !== 'string' || !this.author;

View File

@@ -45,6 +45,7 @@ class Presence {
/** /**
* The user of this presence * The user of this presence
* @type {?User} * @type {?User}
* @readonly
*/ */
get user() { get user() {
return this.client.users.get(this.userID) || null; return this.client.users.get(this.userID) || null;
@@ -53,6 +54,7 @@ class Presence {
/** /**
* The member of this presence * The member of this presence
* @type {?GuildMember} * @type {?GuildMember}
* @readonly
*/ */
get member() { get member() {
return this.guild.members.get(this.userID) || null; return this.guild.members.get(this.userID) || null;

View File

@@ -78,6 +78,7 @@ class User extends Base {
/** /**
* Whether this User is a partial * Whether this User is a partial
* @type {boolean} * @type {boolean}
* @readonly
*/ */
get partial() { get partial() {
return typeof this.username !== 'string'; return typeof this.username !== 'string';

View File

@@ -30,6 +30,7 @@ class VoiceChannel extends GuildChannel {
* The members in this voice channel * The members in this voice channel
* @type {Collection<Snowflake, GuildMember>} * @type {Collection<Snowflake, GuildMember>}
* @name VoiceChannel#members * @name VoiceChannel#members
* @readonly
*/ */
get members() { get members() {
const coll = new Collection(); const coll = new Collection();

View File

@@ -58,6 +58,7 @@ class VoiceState extends Base {
/** /**
* The member that this voice state belongs to * The member that this voice state belongs to
* @type {?GuildMember} * @type {?GuildMember}
* @readonly
*/ */
get member() { get member() {
return this.guild.members.get(this.id) || null; return this.guild.members.get(this.id) || null;
@@ -66,6 +67,7 @@ class VoiceState extends Base {
/** /**
* The channel that the member is connected to * The channel that the member is connected to
* @type {?VoiceChannel} * @type {?VoiceChannel}
* @readonly
*/ */
get channel() { get channel() {
return this.guild.channels.get(this.channelID) || null; return this.guild.channels.get(this.channelID) || null;
@@ -74,6 +76,7 @@ class VoiceState extends Base {
/** /**
* Whether this member is either self-deafened or server-deafened * Whether this member is either self-deafened or server-deafened
* @type {?boolean} * @type {?boolean}
* @readonly
*/ */
get deaf() { get deaf() {
return this.serverDeaf || this.selfDeaf; return this.serverDeaf || this.selfDeaf;
@@ -82,6 +85,7 @@ class VoiceState extends Base {
/** /**
* Whether this member is either self-muted or server-muted * Whether this member is either self-muted or server-muted
* @type {?boolean} * @type {?boolean}
* @readonly
*/ */
get mute() { get mute() {
return this.serverMute || this.selfMute; return this.serverMute || this.selfMute;
@@ -91,6 +95,7 @@ class VoiceState extends Base {
* Whether this member is currently speaking. A boolean if the information is available (aka * Whether this member is currently speaking. A boolean if the information is available (aka
* the bot is connected to any voice channel in the guild), otherwise this is null * the bot is connected to any voice channel in the guild), otherwise this is null
* @type {?boolean} * @type {?boolean}
* @readonly
*/ */
get speaking() { get speaking() {
return this.channel && this.channel.connection ? return this.channel && this.channel.connection ?