mirror of
https://github.com/danbulant/discord.js
synced 2026-05-27 22:11:53 +00:00
fix: emit voiceStateUpdate on guildMemberRemove (#2892)
* fix: emit voiceStateUpdate on guildMemberRemove * apparently i am blind * typings
This commit is contained in:
parent
9cf50d05f2
commit
183ba25faf
2 changed files with 8 additions and 6 deletions
|
|
@ -26,8 +26,10 @@ class VoiceStateUpdateHandler extends AbstractHandler {
|
|||
}
|
||||
|
||||
// Emit event
|
||||
if (member) {
|
||||
if (member.user.id === client.user.id && data.channel_id) client.emit('self.voiceStateUpdate', data);
|
||||
if (member && member.user.id === client.user.id && data.channel_id) {
|
||||
client.emit('self.voiceStateUpdate', data);
|
||||
}
|
||||
if (oldState || newState) {
|
||||
client.emit(Events.VOICE_STATE_UPDATE, oldState, newState);
|
||||
}
|
||||
}
|
||||
|
|
@ -37,8 +39,8 @@ class VoiceStateUpdateHandler extends AbstractHandler {
|
|||
/**
|
||||
* Emitted whenever a member changes voice state - e.g. joins/leaves a channel, mutes/unmutes.
|
||||
* @event Client#voiceStateUpdate
|
||||
* @param {VoiceState} oldState The voice state before the update
|
||||
* @param {VoiceState} newState The voice state after the update
|
||||
* @param {?VoiceState} oldState The voice state before the update
|
||||
* @param {?VoiceState} newState The voice state after the update
|
||||
*/
|
||||
|
||||
module.exports = VoiceStateUpdateHandler;
|
||||
|
|
|
|||
4
typings/index.d.ts
vendored
4
typings/index.d.ts
vendored
|
|
@ -195,7 +195,7 @@ declare module 'discord.js' {
|
|||
public on(event: 'roleUpdate', listener: (oldRole: Role, newRole: Role) => void): this;
|
||||
public on(event: 'typingStart' | 'typingStop', listener: (channel: Channel, user: User) => void): this;
|
||||
public on(event: 'userUpdate', listener: (oldUser: User, newUser: User) => void): this;
|
||||
public on(event: 'voiceStateUpdate', listener: (oldState: VoiceState, newState: VoiceState) => void): this;
|
||||
public on(event: 'voiceStateUpdate', listener: (oldState?: VoiceState, newState?: VoiceState) => void): this;
|
||||
public on(event: 'webhookUpdate', listener: (channel: TextChannel) => void): this;
|
||||
public on(event: string, listener: Function): this;
|
||||
|
||||
|
|
@ -227,7 +227,7 @@ declare module 'discord.js' {
|
|||
public once(event: 'roleUpdate', listener: (oldRole: Role, newRole: Role) => void): this;
|
||||
public once(event: 'typingStart' | 'typingStop', listener: (channel: Channel, user: User) => void): this;
|
||||
public once(event: 'userUpdate', listener: (oldUser: User, newUser: User) => void): this;
|
||||
public once(event: 'voiceStateUpdate', listener: (oldState: VoiceState, newState: VoiceState) => void): this;
|
||||
public once(event: 'voiceStateUpdate', listener: (oldState?: VoiceState, newState?: VoiceState) => void): this;
|
||||
public once(event: 'webhookUpdate', listener: (channel: TextChannel) => void): this;
|
||||
public once(event: string, listener: Function): this;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue