From 501772a9b5632de5891b99944ced8759d9215ad3 Mon Sep 17 00:00:00 2001 From: rigormorrtiss Date: Sat, 5 Jun 2021 12:05:13 +0400 Subject: [PATCH] fix: VoiceState#member is not nullable (#1018) This reverts commit 7750f8f4676fdfdd36637637d6781ba46657bfb0. --- src/handlers/voice/VOICE_STATE_UPDATE.ts | 3 --- src/types/discordeno/event_handlers.ts | 5 ++--- src/types/voice/voice_state.ts | 4 ++-- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/src/handlers/voice/VOICE_STATE_UPDATE.ts b/src/handlers/voice/VOICE_STATE_UPDATE.ts index 3406114c1..8e2f3b514 100644 --- a/src/handlers/voice/VOICE_STATE_UPDATE.ts +++ b/src/handlers/voice/VOICE_STATE_UPDATE.ts @@ -9,9 +9,6 @@ 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; diff --git a/src/types/discordeno/event_handlers.ts b/src/types/discordeno/event_handlers.ts index 176abee8e..60d59545c 100644 --- a/src/types/discordeno/event_handlers.ts +++ b/src/types/discordeno/event_handlers.ts @@ -9,7 +9,8 @@ import type { StageInstance } from "../channels/stage_instance.ts"; import type { ThreadMember } from "../channels/threads/thread_member.ts"; import type { ThreadMembersUpdate } from "../channels/threads/thread_members_update.ts"; import type { Emoji } from "../emojis/emoji.ts"; -import type { DiscordGatewayPayload, GatewayPayload } from "../gateway/gateway_payload.ts"; +import type { GatewayPayload } from "../gateway/gateway_payload.ts"; +import type { DiscordGatewayPayload } from "../gateway/gateway_payload.ts"; import type { IntegrationCreateUpdate } from "../integrations/integration_create_update.ts"; import type { IntegrationDelete } from "../integrations/integration_delete.ts"; import type { ApplicationCommandCreateUpdateDelete } from "../interactions/commands/application_command_create_update_delete.ts"; @@ -144,8 +145,6 @@ export type EventHandlersDefinitions = { voiceChannelLeave: [member: DiscordenoMember, channelId: bigint]; /** Sent when a user switches the voice channel */ voiceChannelSwitch: [member: DiscordenoMember, channelId: bigint, oldChannelId: bigint]; - /** Sent when a user/lurker joins a live stage, but they are not inside the guild. */ - voiceLurkerJoin: [voiceState: VoiceState]; /** Sent when a voice server is updated with information for making the bot connect to a voice channel. */ voiceServerUpdate: [payload: VoiceServerUpdate, guild: DiscordenoGuild]; /** Sent when someone joins/leaves/moves voice channels. */ diff --git a/src/types/voice/voice_state.ts b/src/types/voice/voice_state.ts index 446bb122b..156e15ad4 100644 --- a/src/types/voice/voice_state.ts +++ b/src/types/voice/voice_state.ts @@ -8,8 +8,8 @@ export interface VoiceState { channelId: string | null; /** The user id this voice state is for */ userId: string; - /** The guild member this voice state is for, or `null` if the user is in a live stage but not in the guild */ - member?: GuildMemberWithUser | null; + /** The guild member this voice state is for */ + member?: GuildMemberWithUser; /** The session id for this voice state */ sessionId: string; /** Whether this user is deafened by the server */