fix: VoiceState#member nullable (#995)

* fix(types/voice): member field in VoiceState is nullable

* member is optional for live stages

* Update JSDoc comment block for VoiceState#member

* Revert "member is optional for live stages"

This reverts commit 2faa8b129b.

* feat(handlers/voice): add voiceLurkerJoin event
This commit is contained in:
rigormorrtiss
2021-06-04 22:45:47 +04:00
committed by GitHub
parent 7b9da2cb1f
commit 7750f8f467
3 changed files with 8 additions and 4 deletions
+3
View File
@@ -9,6 +9,9 @@ export async function handleVoiceStateUpdate(data: DiscordGatewayPayload) {
const payload = data.d as VoiceState;
if (!payload.guildId) return;
// The "member" field in the payload is `null` if the user is in a live stage but not in the guild.
if (payload.member === null) return eventHandlers.voiceLurkerJoin?.(payload);
const guild = await cacheHandlers.get("guilds", snowflakeToBigint(payload.guildId));
if (!guild) return;