Calling support (1)

This commit is contained in:
March 7th
2022-05-21 20:58:33 +07:00
parent cc9c4f3145
commit f9ec41c9b6
11 changed files with 303 additions and 39 deletions

View File

@@ -29,6 +29,26 @@ class VoiceStateUpdate extends Action {
client.voice.onVoiceStateUpdate(data);
}
/**
* 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
*/
client.emit(Events.VOICE_STATE_UPDATE, oldState, newState);
} else {
// Update the state
const oldState =
client.voiceStates.cache.get(data.user_id)?._clone() ?? new VoiceState({ client }, { user_id: data.user_id });
const newState = client.voiceStates._add(data);
// Emit event
if (data.user_id === client.user.id) {
client.emit('debug', `[VOICE] received voice state update: ${JSON.stringify(data)}`);
client.voice.onVoiceStateUpdate(data);
}
/**
* Emitted whenever a member changes voice state - e.g. joins/leaves a channel, mutes/unmutes.
* @event Client#voiceStateUpdate