mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-01-05 19:57:02 +00:00
Voice: Added intent adders into constructor
This commit is contained in:
parent
456692da93
commit
f85aac09be
|
@ -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),
|
||||
|
|
Loading…
Reference in a new issue