Class GuildVoiceUpdateEvent

All Implemented Interfaces:
GenericEvent, UpdateEvent<Member,AudioChannel>

public class GuildVoiceUpdateEvent extends GenericGuildVoiceEvent implements UpdateEvent<Member,AudioChannel>
Indicates that a Member joined or left an AudioChannel.

Can be used to detect when a Member leaves/joins an AudioChannel.

Example


 AudioChannelUnion joinedChannel = event.getChannelJoined();
 AudioChannelUnion leftChannel = event.getChannelLeft();

 if (joinedChannel != null) {
   // the member joined an audio channel
 }
 if (leftChannel != null) {
   // the member left an audio channel
 }
 if (joinedChannel != null && leftChannel != null) {
   // the member moved between two audio channels in the same guild
 }
 

Requirements

This event requires the VOICE_STATE CacheFlag to be enabled, which requires the GUILD_VOICE_STATES intent.
createLight(String) disables that CacheFlag by default!

Additionally, this event requires the MemberCachePolicy to cache the updated members. Discord does not specifically tell us about the updates, but merely tells us the member was updated and gives us the updated member object. In order to fire a specific event like this we need to have the old member cached to compare against.

Identifier: audio-channel