From cf8e226521f00e4213bbab6e0368e7e2de9d2bda Mon Sep 17 00:00:00 2001 From: urbainn Date: Fri, 23 Feb 2024 04:56:29 +0100 Subject: [PATCH] fix voiceChannelLeave event on no cache --- lib/gateway/Shard.ts | 2 +- lib/types/events.d.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/lib/gateway/Shard.ts b/lib/gateway/Shard.ts index f9e0a6a5..50d0e568 100644 --- a/lib/gateway/Shard.ts +++ b/lib/gateway/Shard.ts @@ -1181,7 +1181,7 @@ export default class Shard extends TypedEmitter { this.client.emit("voiceChannelSwitch", member, newChannel, oldChannel); } else if (newChannel) { this.client.emit("voiceChannelJoin", member, newChannel); - } else if (oldChannel) { + } else if (state.channelID === null) { this.client.emit("voiceChannelLeave", member, oldChannel); } } diff --git a/lib/types/events.d.ts b/lib/types/events.d.ts index 6f8a65a0..b6aff774 100644 --- a/lib/types/events.d.ts +++ b/lib/types/events.d.ts @@ -229,7 +229,7 @@ export interface ClientEvents { /** @event Emitted when a user joins a voice channel. Requires the `GUILD_VOICE_STATES` intent. */ voiceChannelJoin: [member: Member, channel: VoiceChannel | StageChannel | Uncached]; /** @event Emitted when a user leaves a voice channel. Requires the `GUILD_VOICE_STATES` intent. */ - voiceChannelLeave: [member: Member, channel: VoiceChannel | StageChannel | Uncached]; + voiceChannelLeave: [member: Member, channel: VoiceChannel | StageChannel | Uncached | null]; /** @event Emitted when a voice channel's status is updated. Requires the `GUILD_VOICE_STATES` intent. */ voiceChannelStatusUpdate: [channel: VoiceChannel | Uncached, status: string | null]; /** @event Emitted when a user switches voice channels. Requires the `GUILD_VOICE_STATES` intent. */