refactor: improve the accuracy of docs/improve docs (#4845)

Co-authored-by: Noel <icrawltogo@gmail.com>
This commit is contained in:
Sugden
2020-10-17 14:53:02 +01:00
committed by GitHub
parent 4bbe716aa0
commit af670fc718
22 changed files with 185 additions and 166 deletions

View File

@@ -165,7 +165,7 @@ class VoiceConnection extends EventEmitter {
/**
* The voice state of this connection
* @type {VoiceState}
* @type {?VoiceState}
*/
get voice() {
return this.channel.guild.voice;
@@ -203,8 +203,8 @@ class VoiceConnection extends EventEmitter {
* Set the token and endpoint required to connect to the voice servers.
* @param {string} token The voice token
* @param {string} endpoint The voice endpoint
* @private
* @returns {void}
* @private
*/
setTokenAndEndpoint(token, endpoint) {
this.emit('debug', `Token "${token}" and endpoint "${endpoint}"`);

View File

@@ -56,7 +56,7 @@ class StreamDispatcher extends Writable {
* The broadcast controlling this dispatcher, if any
* @type {?VoiceBroadcast}
*/
this.broadcast = this.streams.broadcast;
this.broadcast = this.streams.broadcast || null;
this._pausedTime = 0;
this._silentPausedTime = 0;

View File

@@ -43,7 +43,7 @@ class WebSocketManager extends EventEmitter {
* The gateway this manager uses
* @type {?string}
*/
this.gateway = undefined;
this.gateway = null;
/**
* The amount of shards this manager handles
@@ -98,11 +98,11 @@ class WebSocketManager extends EventEmitter {
* The current session limit of the client
* @private
* @type {?Object}
* @prop {number} total Total number of identifies available
* @prop {number} remaining Number of identifies remaining
* @prop {number} reset_after Number of milliseconds after which the limit resets
* @property {number} total Total number of identifies available
* @property {number} remaining Number of identifies remaining
* @property {number} reset_after Number of milliseconds after which the limit resets
*/
this.sessionStartLimit = undefined;
this.sessionStartLimit = null;
}
/**
@@ -212,7 +212,7 @@ class WebSocketManager extends EventEmitter {
if (UNRESUMABLE_CLOSE_CODES.includes(event.code)) {
// These event codes cannot be resumed
shard.sessionID = undefined;
shard.sessionID = null;
}
/**

View File

@@ -56,10 +56,10 @@ class WebSocketShard extends EventEmitter {
/**
* The current session ID of the shard
* @type {string}
* @type {?string}
* @private
*/
this.sessionID = undefined;
this.sessionID = null;
/**
* The previous heartbeat ping of the shard
@@ -124,7 +124,7 @@ class WebSocketShard extends EventEmitter {
* @type {?NodeJS.Timeout}
* @private
*/
Object.defineProperty(this, 'helloTimeout', { value: undefined, writable: true });
Object.defineProperty(this, 'helloTimeout', { value: null, writable: true });
/**
* If the manager attached its event handlers on the shard
@@ -140,7 +140,7 @@ class WebSocketShard extends EventEmitter {
* @type {?Set<string>}
* @private
*/
Object.defineProperty(this, 'expectedGuilds', { value: undefined, writable: true });
Object.defineProperty(this, 'expectedGuilds', { value: null, writable: true });
/**
* The ready timeout
@@ -148,7 +148,7 @@ class WebSocketShard extends EventEmitter {
* @type {?NodeJS.Timeout}
* @private
*/
Object.defineProperty(this, 'readyTimeout', { value: undefined, writable: true });
Object.defineProperty(this, 'readyTimeout', { value: null, writable: true });
/**
* Time when the WebSocket connection was opened
@@ -428,7 +428,7 @@ class WebSocketShard extends EventEmitter {
// Reset the sequence
this.sequence = -1;
// Reset the session ID as it's invalid
this.sessionID = undefined;
this.sessionID = null;
// Set the status to reconnecting
this.status = Status.RECONNECTING;
// Finally, emit the INVALID_SESSION event
@@ -457,7 +457,7 @@ class WebSocketShard extends EventEmitter {
// Step 0. Clear the ready timeout, if it exists
if (this.readyTimeout) {
this.manager.client.clearTimeout(this.readyTimeout);
this.readyTimeout = undefined;
this.readyTimeout = null;
}
// Step 1. If we don't have any other guilds pending, we are ready
if (!this.expectedGuilds.size) {
@@ -480,7 +480,7 @@ class WebSocketShard extends EventEmitter {
this.debug(`Shard did not receive any more guild packets in 15 seconds.
Unavailable guild count: ${this.expectedGuilds.size}`);
this.readyTimeout = undefined;
this.readyTimeout = null;
this.status = Status.READY;
@@ -498,7 +498,7 @@ class WebSocketShard extends EventEmitter {
if (this.helloTimeout) {
this.debug('Clearing the HELLO timeout.');
this.manager.client.clearTimeout(this.helloTimeout);
this.helloTimeout = undefined;
this.helloTimeout = null;
}
return;
}
@@ -519,7 +519,7 @@ class WebSocketShard extends EventEmitter {
if (this.heartbeatInterval) {
this.debug('Clearing the heartbeat interval.');
this.manager.client.clearInterval(this.heartbeatInterval);
this.heartbeatInterval = undefined;
this.heartbeatInterval = null;
}
return;
}
@@ -734,7 +734,7 @@ class WebSocketShard extends EventEmitter {
// Step 5: Reset the sequence and session ID if requested
if (reset) {
this.sequence = -1;
this.sessionID = undefined;
this.sessionID = null;
}
// Step 6: reset the ratelimit data

View File

@@ -44,7 +44,7 @@ class Shard extends EventEmitter {
/**
* Arguments for the shard's process executable (only when {@link ShardingManager#mode} is `process`)
* @type {?string[]}
* @type {string[]}
*/
this.execArgv = manager.execArgv;
@@ -96,7 +96,7 @@ class Shard extends EventEmitter {
* @type {Function}
* @private
*/
this._exitListener = this._handleExit.bind(this, undefined);
this._exitListener = this._handleExit.bind(this);
}
/**

View File

@@ -125,7 +125,7 @@ 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 Client}s.
* @param {string|Function} script JavaScript to run on each shard
* @returns {Promise<Array<*>>} Results of the script execution
* @example

View File

@@ -4,6 +4,7 @@ const Util = require('../util/Util');
/**
* Represents a data model that is identifiable by a Snowflake (i.e. Discord API data models).
* @abstract
*/
class Base {
constructor(client) {

View File

@@ -5,6 +5,7 @@ const Emoji = require('./Emoji');
/**
* Parent class for {@link GuildEmoji} and {@link GuildPreviewEmoji}.
* @extends {Emoji}
* @abstract
*/
class BaseGuildEmoji extends Emoji {
constructor(client, data, guild) {
@@ -16,6 +17,10 @@ class BaseGuildEmoji extends Emoji {
*/
this.guild = guild;
this.requireColons = null;
this.managed = null;
this.available = null;
/**
* Array of role ids this emoji is active for
* @name BaseGuildEmoji#_roles
@@ -30,26 +35,29 @@ class BaseGuildEmoji extends Emoji {
_patch(data) {
if (data.name) this.name = data.name;
/**
* Whether or not this emoji requires colons surrounding it
* @type {?boolean}
* @name GuildEmoji#requiresColons
*/
if (typeof data.require_colons !== 'undefined') this.requiresColons = data.require_colons;
if (typeof data.require_colons !== 'undefined') {
/**
* Whether or not this emoji requires colons surrounding it
* @type {?boolean}
*/
this.requiresColons = data.require_colons;
}
/**
* Whether this emoji is managed by an external service
* @type {?boolean}
* @name GuildEmoji#managed
*/
if (typeof data.managed !== 'undefined') this.managed = data.managed;
if (typeof data.managed !== 'undefined') {
/**
* Whether this emoji is managed by an external service
* @type {?boolean}
*/
this.managed = data.managed;
}
/**
* Whether this emoji is available
* @type {?boolean}
* @name GuildEmoji#available
*/
if (typeof data.available !== 'undefined') this.available = data.available;
if (typeof data.available !== 'undefined') {
/**
* Whether this emoji is available
* @type {?boolean}
*/
this.available = data.available;
}
if (data.roles) this._roles = data.roles;
}

View File

@@ -7,6 +7,7 @@ const Snowflake = require('../util/Snowflake');
/**
* Represents any channel on Discord.
* @extends {Base}
* @abstract
*/
class Channel extends Base {
constructor(client, data) {

View File

@@ -231,36 +231,38 @@ class Guild extends Base {
*/
this.premiumTier = data.premium_tier;
/**
* The total number of boosts for this server
* @type {?number}
* @name Guild#premiumSubscriptionCount
*/
if (typeof data.premium_subscription_count !== 'undefined') {
/**
* The total number of boosts for this server
* @type {?number}
*/
this.premiumSubscriptionCount = data.premium_subscription_count;
}
/**
* Whether widget images are enabled on this guild
* @type {?boolean}
* @name Guild#widgetEnabled
*/
if (typeof data.widget_enabled !== 'undefined') this.widgetEnabled = data.widget_enabled;
if (typeof data.widget_enabled !== 'undefined') {
/**
* Whether widget images are enabled on this guild
* @type {?boolean}
*/
this.widgetEnabled = data.widget_enabled;
}
/**
* The widget channel ID, if enabled
* @type {?string}
* @name Guild#widgetChannelID
*/
if (typeof data.widget_channel_id !== 'undefined') this.widgetChannelID = data.widget_channel_id;
if (typeof data.widget_channel_id !== 'undefined') {
/**
* The widget channel ID, if enabled
* @type {?string}
*/
this.widgetChannelID = data.widget_channel_id;
}
/**
* The embed channel ID, if enabled
* @type {?string}
* @name Guild#embedChannelID
* @deprecated
*/
if (typeof data.embed_channel_id !== 'undefined') this.embedChannelID = data.embed_channel_id;
if (typeof data.embed_channel_id !== 'undefined') {
/**
* The embed channel ID, if enabled
* @type {?string}
* @deprecated
*/
this.embedChannelID = data.embed_channel_id;
}
/**
* The verification level of the guild
@@ -299,40 +301,47 @@ class Guild extends Base {
*/
this.systemChannelFlags = new SystemChannelFlags(data.system_channel_flags).freeze();
/**
* The maximum amount of members the guild can have
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
* @type {?number}
* @name Guild#maximumMembers
*/
if (typeof data.max_members !== 'undefined') this.maximumMembers = data.max_members || 250000;
/**
* The maximum amount of presences the guild can have
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
* @type {?number}
* @name Guild#maximumPresences
*/
if (typeof data.max_presences !== 'undefined') this.maximumPresences = data.max_presences || 25000;
/**
* The approximate amount of members the guild has
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
* @type {?number}
* @name Guild#approximateMemberCount
*/
if (typeof data.approximate_member_count !== 'undefined') {
this.approximateMemberCount = data.approximate_member_count;
if (typeof data.max_members !== 'undefined') {
/**
* The maximum amount of members the guild can have
* @type {?number}
*/
this.maximumMembers = data.max_members;
} else if (typeof this.maximumMembers === 'undefined') {
this.maximumMembers = null;
}
if (typeof data.max_presences !== 'undefined') {
/**
* The maximum amount of presences the guild can have
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
* @type {?number}
*/
this.maximumPresences = data.max_presences || 25000;
} else if (typeof this.maximumPresences === 'undefined') {
this.maximumPresences = null;
}
if (typeof data.approximate_member_count !== 'undefined') {
/**
* The approximate amount of members the guild has
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
* @type {?number}
*/
this.approximateMemberCount = data.approximate_member_count;
} else if (typeof this.approximateMemberCount === 'undefined') {
this.approximateMemberCount = null;
}
/**
* The approximate amount of presences the guild has
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
* @type {?number}
* @name Guild#approximatePresenceCount
*/
if (typeof data.approximate_presence_count !== 'undefined') {
/**
* The approximate amount of presences the guild has
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
* @type {?number}
*/
this.approximatePresenceCount = data.approximate_presence_count;
} else if (typeof this.approximatePresenceCount === 'undefined') {
this.approximatePresenceCount = null;
}
/**

View File

@@ -24,7 +24,7 @@ const Util = require('../util/Util');
/**
* Key mirror of all available audit log targets.
* @name GuildAuditLogs.Targets
* @type {AuditLogTargetType}
* @type {Object<string, string>}
*/
const Targets = {
ALL: 'ALL',
@@ -84,7 +84,7 @@ const Targets = {
/**
* All available actions keyed under their names to their numeric values.
* @name GuildAuditLogs.Actions
* @type {AuditLogAction}
* @type {Object<string, number>}
*/
const Actions = {
ALL: null,

View File

@@ -17,6 +17,7 @@ const Util = require('../util/Util');
* - {@link NewsChannel}
* - {@link StoreChannel}
* @extends {Channel}
* @abstract
*/
class GuildChannel extends Channel {
/**
@@ -31,6 +32,8 @@ class GuildChannel extends Channel {
* @type {Guild}
*/
this.guild = guild;
this.parentID = null;
}
_patch(data) {
@@ -298,7 +301,7 @@ class GuildChannel extends Channel {
* @property {boolean} [nsfw] Whether the channel is NSFW
* @property {number} [bitrate] The bitrate of the voice channel
* @property {number} [userLimit] The user limit of the voice channel
* @property {Snowflake} [parentID] The parent ID of the channel
* @property {?Snowflake} [parentID] The parent ID of the channel
* @property {boolean} [lockPermissions]
* Lock the permissions of the channel to what the parent's permissions are
* @property {OverwriteResolvable[]|Collection<Snowflake, OverwriteResolvable>} [permissionOverwrites]

View File

@@ -61,7 +61,6 @@ class GuildMember extends Base {
/**
* The nickname of this member, if they have one
* @type {?string}
* @name GuildMember#nickname
*/
this.nickname = null;
@@ -74,7 +73,6 @@ class GuildMember extends Base {
/**
* The user that this guild member instance represents
* @type {User}
* @name GuildMember#user
*/
this.user = this.client.users.add(data.user, true);
}

View File

@@ -75,7 +75,7 @@ class GuildPreview extends Base {
* The description for this guild
* @type {?string}
*/
this.description = data.description;
this.description = data.description || null;
if (!this.emojis) {
/**

View File

@@ -65,6 +65,8 @@ class Integration extends Base {
* @type {?User}
*/
this.user = this.client.users.add(data.user);
} else {
this.user = null;
}
/**

View File

@@ -29,37 +29,37 @@ class MessageEmbed {
* * `link` - a link embed
* @type {string}
*/
this.type = data.type;
this.type = data.type || 'rich';
/**
* The title of this embed
* @type {?string}
*/
this.title = data.title;
this.title = 'title' in data ? data.title : null;
/**
* The description of this embed
* @type {?string}
*/
this.description = data.description;
this.description = 'description' in data ? data.description : null;
/**
* The URL of this embed
* @type {?string}
*/
this.url = data.url;
this.url = 'url' in data ? data.url : null;
/**
* The color of this embed
* @type {?number}
*/
this.color = Util.resolveColor(data.color);
this.color = 'color' in data ? Util.resolveColor(data.color) : null;
/**
* The timestamp of this embed
* @type {?number}
*/
this.timestamp = data.timestamp ? new Date(data.timestamp).getTime() : null;
this.timestamp = 'timestamp' in data ? new Date(data.timestamp).getTime() : null;
/**
* Represents a field of a MessageEmbed
@@ -331,7 +331,7 @@ class MessageEmbed {
*/
setFooter(text, iconURL) {
text = Util.resolveString(text);
this.footer = { text, iconURL, proxyIconURL: undefined };
this.footer = { text, iconURL };
return this;
}

View File

@@ -46,13 +46,14 @@ class MessageReaction {
}
_patch(data) {
/**
* The number of people that have given the same reaction
* @type {?number}
* @name MessageReaction#count
*/
// eslint-disable-next-line eqeqeq
if (this.count == undefined) this.count = data.count;
if (this.count == undefined) {
/**
* The number of people that have given the same reaction
* @type {?number}
*/
this.count = data.count;
}
}
/**

View File

@@ -184,8 +184,8 @@ class Activity {
/**
* Timestamps for the activity
* @type {?Object}
* @prop {?Date} start When the activity started
* @prop {?Date} end When the activity will end
* @property {?Date} start When the activity started
* @property {?Date} end When the activity will end
*/
this.timestamps = data.timestamps
? {
@@ -197,8 +197,8 @@ 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]`
* @property {?string} id ID of the party
* @property {number[]} size Size of the party as `[current, max]`
*/
this.party = data.party || null;

View File

@@ -27,6 +27,10 @@ class User extends Base {
*/
this.id = data.id;
this.system = null;
this.locale = null;
this.flags = null;
this._patch(data);
}
@@ -35,7 +39,6 @@ class User extends Base {
/**
* The username of the user
* @type {?string}
* @name User#username
*/
this.username = data.username;
} else if (typeof this.username !== 'string') {
@@ -45,7 +48,6 @@ class User extends Base {
/**
* Whether or not the user is a bot
* @type {boolean}
* @name User#bot
*/
this.bot = Boolean(data.bot);
@@ -53,7 +55,6 @@ class User extends Base {
/**
* A discriminator based on username for the user
* @type {?string}
* @name User#discriminator
*/
this.discriminator = data.discriminator;
} else if (typeof this.discriminator !== 'string') {
@@ -64,7 +65,6 @@ class User extends Base {
/**
* The ID of the user's avatar
* @type {?string}
* @name User#avatar
*/
this.avatar = data.avatar;
} else if (typeof this.avatar !== 'string') {
@@ -75,7 +75,6 @@ class User extends Base {
/**
* Whether the user is an Official Discord System user (part of the urgent message system)
* @type {?boolean}
* @name User#system
*/
this.system = Boolean(data.system);
}
@@ -84,7 +83,6 @@ class User extends Base {
/**
* The locale of the user's client (ISO 639-1)
* @type {?string}
* @name User#locale
*/
this.locale = data.locale;
}
@@ -93,7 +91,6 @@ class User extends Base {
/**
* The flags for this user
* @type {?UserFlags}
* @name User#flags
*/
this.flags = new UserFlags(data.public_flags);
}

View File

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

View File

@@ -32,32 +32,32 @@ class VoiceState extends Base {
* Whether this member is deafened server-wide
* @type {?boolean}
*/
this.serverDeaf = data.deaf;
this.serverDeaf = 'deaf' in data ? data.deaf : null;
/**
* Whether this member is muted server-wide
* @type {?boolean}
*/
this.serverMute = data.mute;
this.serverMute = 'mute' in data ? data.mute : null;
/**
* Whether this member is self-deafened
* @type {?boolean}
*/
this.selfDeaf = data.self_deaf;
this.selfDeaf = 'self_deaf' in data ? data.self_deaf : null;
/**
* Whether this member is self-muted
* @type {?boolean}
*/
this.selfMute = data.self_mute;
this.selfMute = 'self_mute' in data ? data.self_mute : null;
/**
* Whether this member's camera is enabled
* @type {boolean}
* @type {?boolean}
*/
this.selfVideo = data.self_video;
this.selfVideo = 'self_video' in data ? data.self_video : null;
/**
* The session ID of this member's connection
* @type {?string}
*/
this.sessionID = data.session_id;
this.sessionID = 'session_id' in data ? data.session_id : null;
/**
* Whether this member is streaming using "Go Live"
* @type {boolean}
@@ -67,7 +67,7 @@ class VoiceState extends Base {
* The ID of the voice channel that this member is in
* @type {?Snowflake}
*/
this.channelID = data.channel_id;
this.channelID = data.channel_id || null;
return this;
}

64
typings/index.d.ts vendored
View File

@@ -142,13 +142,13 @@ declare module 'discord.js' {
constructor(client: Client, data: object, guild: Guild);
private _roles: string[];
public available?: boolean;
public available: boolean | null;
public readonly createdAt: Date;
public readonly createdTimestamp: number;
public guild: Guild | GuildPreview;
public id: Snowflake;
public managed?: boolean;
public requiresColons?: boolean;
public managed: boolean | null;
public requiresColons: boolean | null;
}
class BroadcastDispatcher extends VolumeMixin(StreamDispatcher) {
@@ -625,8 +625,8 @@ declare module 'discord.js' {
public afkChannelID: Snowflake | null;
public afkTimeout: number;
public applicationID: Snowflake | null;
public approximateMemberCount?: number;
public approximatePresenceCount?: number;
public approximateMemberCount: number | null;
public approximatePresenceCount: number | null;
public available: boolean;
public banner: string | null;
public channels: GuildChannelManager;
@@ -818,7 +818,7 @@ declare module 'discord.js' {
public permissionsFor(memberOrRole: GuildMemberResolvable | RoleResolvable): Readonly<Permissions> | null;
public setName(name: string, reason?: string): Promise<this>;
public setParent(
channel: CategoryChannel | Snowflake,
channel: CategoryChannel | Snowflake | null,
options?: { lockPermissions?: boolean; reason?: string },
): Promise<this>;
public setPosition(position: number, options?: { relative?: boolean; reason?: string }): Promise<this>;
@@ -932,7 +932,7 @@ declare module 'discord.js' {
public syncedAt: number;
public syncing: boolean;
public type: string;
public user?: User;
public user: User | null;
public delete(reason?: string): Promise<Integration>;
public edit(data: IntegrationEditData, reason?: string): Promise<Integration>;
public sync(): Promise<Integration>;
@@ -1054,7 +1054,7 @@ declare module 'discord.js' {
public attachment: BufferResolvable | Stream;
public height: number | null;
public id: Snowflake;
public name?: string;
public name: string | null;
public proxyURL: string;
public size: number;
public readonly spoiler: boolean;
@@ -1082,9 +1082,9 @@ declare module 'discord.js' {
export class MessageEmbed {
constructor(data?: MessageEmbed | MessageEmbedOptions);
public author: MessageEmbedAuthor | null;
public color?: number;
public color: number | null;
public readonly createdAt: Date | null;
public description?: string;
public description: string | null;
public fields: EmbedField[];
public files: (MessageAttachment | string | FileOptions)[];
public footer: MessageEmbedFooter | null;
@@ -1094,9 +1094,9 @@ declare module 'discord.js' {
public provider: MessageEmbedProvider | null;
public thumbnail: MessageEmbedThumbnail | null;
public timestamp: number | null;
public title?: string;
public title: string | null;
public type: string;
public url?: string;
public url: string | null;
public readonly video: MessageEmbedVideo | null;
public addField(name: StringResolvable, value: StringResolvable, inline?: boolean): this;
public addFields(...fields: EmbedFieldData[] | EmbedFieldData[][]): this;
@@ -1540,13 +1540,13 @@ declare module 'discord.js' {
public discriminator: string;
public readonly defaultAvatarURL: string;
public readonly dmChannel: DMChannel | null;
public flags?: Readonly<UserFlags>;
public flags: Readonly<UserFlags> | null;
public id: Snowflake;
public lastMessageID: Snowflake | null;
public locale?: string;
public locale: string | null;
public readonly partial: false;
public readonly presence: Presence;
public system?: boolean;
public system: boolean | null;
public readonly tag: string;
public username: string;
public avatarURL(options?: ImageURLOptions & { dynamic?: boolean }): string | null;
@@ -1613,7 +1613,7 @@ declare module 'discord.js' {
constructor(client: Client);
public client: Client;
public subscribers: StreamDispatcher[];
public readonly dispatcher?: BroadcastDispatcher;
public readonly dispatcher: BroadcastDispatcher | null;
public play(input: string | Readable, options?: StreamOptions): BroadcastDispatcher;
public end(): void;
@@ -1669,7 +1669,7 @@ declare module 'discord.js' {
public receiver: VoiceReceiver;
public speaking: Readonly<Speaking>;
public status: VoiceStatus;
public readonly voice: VoiceState;
public readonly voice: VoiceState | null;
public voiceManager: ClientVoiceManager;
public disconnect(): void;
public play(input: VoiceBroadcast | Readable | string, options?: StreamOptions): StreamDispatcher;
@@ -1721,18 +1721,18 @@ declare module 'discord.js' {
export class VoiceState extends Base {
constructor(guild: Guild, data: object);
public readonly channel: VoiceChannel | null;
public channelID?: Snowflake;
public channelID: Snowflake | null;
public readonly connection: VoiceConnection | null;
public readonly deaf?: boolean;
public readonly deaf: boolean | null;
public guild: Guild;
public id: Snowflake;
public readonly member: GuildMember | null;
public readonly mute?: boolean;
public selfDeaf?: boolean;
public selfMute?: boolean;
public serverDeaf?: boolean;
public serverMute?: boolean;
public sessionID?: string;
public readonly mute: boolean | null;
public selfDeaf: boolean | null;
public selfMute: boolean | null;
public serverDeaf: boolean | null;
public serverMute: boolean | null;
public sessionID: string | null;
public streaming: boolean;
public selfVideo: boolean;
public readonly speaking: boolean | null;
@@ -1786,10 +1786,10 @@ declare module 'discord.js' {
private packetQueue: object[];
private destroyed: boolean;
private reconnecting: boolean;
private sessionStartLimit?: { total: number; remaining: number; reset_after: number };
private sessionStartLimit: { total: number; remaining: number; reset_after: number } | null;
public readonly client: Client;
public gateway?: string;
public gateway: string | null;
public shards: Collection<number, WebSocketShard>;
public status: Status;
public readonly ping: number;
@@ -1813,15 +1813,15 @@ declare module 'discord.js' {
constructor(manager: WebSocketManager, id: number);
private sequence: number;
private closeSequence: number;
private sessionID?: string;
private sessionID: string | null;
private lastPingTimestamp: number;
private lastHeartbeatAcked: boolean;
private ratelimit: { queue: object[]; total: number; remaining: number; time: 60e3; timer: NodeJS.Timeout | null };
private connection: WebSocket | null;
private helloTimeout: NodeJS.Timeout | undefined;
private helloTimeout: NodeJS.Timeout | null;
private eventsAttached: boolean;
private expectedGuilds: Set<Snowflake> | undefined;
private readyTimeout: NodeJS.Timeout | undefined;
private expectedGuilds: Set<Snowflake> | null;
private readyTimeout: NodeJS.Timeout | null;
public manager: WebSocketManager;
public id: number;
@@ -2234,7 +2234,7 @@ declare module 'discord.js' {
nsfw?: boolean;
bitrate?: number;
userLimit?: number;
parentID?: Snowflake;
parentID?: Snowflake | null;
rateLimitPerUser?: number;
lockPermissions?: boolean;
permissionOverwrites?: readonly OverwriteResolvable[] | Collection<Snowflake, OverwriteResolvable>;