diff --git a/voice/voice.go b/voice/voice.go index 429dd52..7c91ec1 100644 --- a/voice/voice.go +++ b/voice/voice.go @@ -52,6 +52,9 @@ func NewVoiceFromToken(token string) (*Voice, error) { // NewVoice creates a new Voice repository wrapped around a state. The function // will also automatically add the GuildVoiceStates intent, as that is required. +// +// This function will add the Guilds and GuildVoiceStates intents into the state +// in order to receive the needed events. func NewVoice(s *state.State) *Voice { v := &Voice{ State: s, @@ -59,6 +62,10 @@ func NewVoice(s *state.State) *Voice { ErrorLog: defaultErrorHandler, } + // Register the voice intents. + s.Gateway.AddIntents(gateway.IntentGuilds) + s.Gateway.AddIntents(gateway.IntentGuildVoiceStates) + // Add the required event handlers to the session. v.closers = []func(){ s.AddHandler(v.onVoiceStateUpdate),