From a0d5f13dd9b27c44f5183a2a9af4c4fdecb312c0 Mon Sep 17 00:00:00 2001 From: Jiralite <33201955+Jiralite@users.noreply.github.com> Date: Fri, 7 Jan 2022 22:40:58 +0000 Subject: [PATCH] fix(VoiceState): Ensure `suppress` & `streaming` have proper fallback values (#6377) --- packages/discord.js/src/structures/VoiceState.js | 6 ++++-- packages/discord.js/typings/index.d.ts | 4 ++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/packages/discord.js/src/structures/VoiceState.js b/packages/discord.js/src/structures/VoiceState.js index 78d9bf551..7ed9ee752 100644 --- a/packages/discord.js/src/structures/VoiceState.js +++ b/packages/discord.js/src/structures/VoiceState.js @@ -88,7 +88,7 @@ class VoiceState extends Base { if ('self_video' in data) { /** * Whether this member is streaming using "Screen Share" - * @type {boolean} + * @type {?boolean} */ this.streaming = data.self_stream ?? false; } else { @@ -108,9 +108,11 @@ class VoiceState extends Base { if ('suppress' in data) { /** * Whether this member is suppressed from speaking. This property is specific to stage channels only. - * @type {boolean} + * @type {?boolean} */ this.suppress = data.suppress; + } else { + this.suppress ??= null; } if ('request_to_speak_timestamp' in data) { diff --git a/packages/discord.js/typings/index.d.ts b/packages/discord.js/typings/index.d.ts index 4ba74fe42..77b93c5e9 100644 --- a/packages/discord.js/typings/index.d.ts +++ b/packages/discord.js/typings/index.d.ts @@ -2506,9 +2506,9 @@ export class VoiceState extends Base { public serverDeaf: boolean | null; public serverMute: boolean | null; public sessionId: string | null; - public streaming: boolean; + public streaming: boolean | null; public selfVideo: boolean | null; - public suppress: boolean; + public suppress: boolean | null; public requestToSpeakTimestamp: number | null; public setDeaf(deaf?: boolean, reason?: string): Promise;