mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-16 03:18:17 +00:00
fix: VoiceState#member is not nullable (#1018)
This reverts commit 7750f8f467.
This commit is contained in:
@@ -9,9 +9,6 @@ export async function handleVoiceStateUpdate(data: DiscordGatewayPayload) {
|
|||||||
const payload = data.d as VoiceState;
|
const payload = data.d as VoiceState;
|
||||||
if (!payload.guildId) return;
|
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));
|
const guild = await cacheHandlers.get("guilds", snowflakeToBigint(payload.guildId));
|
||||||
if (!guild) return;
|
if (!guild) return;
|
||||||
|
|
||||||
|
|||||||
@@ -9,7 +9,8 @@ import type { StageInstance } from "../channels/stage_instance.ts";
|
|||||||
import type { ThreadMember } from "../channels/threads/thread_member.ts";
|
import type { ThreadMember } from "../channels/threads/thread_member.ts";
|
||||||
import type { ThreadMembersUpdate } from "../channels/threads/thread_members_update.ts";
|
import type { ThreadMembersUpdate } from "../channels/threads/thread_members_update.ts";
|
||||||
import type { Emoji } from "../emojis/emoji.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 { IntegrationCreateUpdate } from "../integrations/integration_create_update.ts";
|
||||||
import type { IntegrationDelete } from "../integrations/integration_delete.ts";
|
import type { IntegrationDelete } from "../integrations/integration_delete.ts";
|
||||||
import type { ApplicationCommandCreateUpdateDelete } from "../interactions/commands/application_command_create_update_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];
|
voiceChannelLeave: [member: DiscordenoMember, channelId: bigint];
|
||||||
/** Sent when a user switches the voice channel */
|
/** Sent when a user switches the voice channel */
|
||||||
voiceChannelSwitch: [member: DiscordenoMember, channelId: bigint, oldChannelId: bigint];
|
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. */
|
/** Sent when a voice server is updated with information for making the bot connect to a voice channel. */
|
||||||
voiceServerUpdate: [payload: VoiceServerUpdate, guild: DiscordenoGuild];
|
voiceServerUpdate: [payload: VoiceServerUpdate, guild: DiscordenoGuild];
|
||||||
/** Sent when someone joins/leaves/moves voice channels. */
|
/** Sent when someone joins/leaves/moves voice channels. */
|
||||||
|
|||||||
@@ -8,8 +8,8 @@ export interface VoiceState {
|
|||||||
channelId: string | null;
|
channelId: string | null;
|
||||||
/** The user id this voice state is for */
|
/** The user id this voice state is for */
|
||||||
userId: string;
|
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 */
|
/** The guild member this voice state is for */
|
||||||
member?: GuildMemberWithUser | null;
|
member?: GuildMemberWithUser;
|
||||||
/** The session id for this voice state */
|
/** The session id for this voice state */
|
||||||
sessionId: string;
|
sessionId: string;
|
||||||
/** Whether this user is deafened by the server */
|
/** Whether this user is deafened by the server */
|
||||||
|
|||||||
Reference in New Issue
Block a user