mirror of
https://github.com/diamondburned/arikawa.git
synced 2025-01-08 13:07:43 +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
|
// NewVoice creates a new Voice repository wrapped around a state. The function
|
||||||
// will also automatically add the GuildVoiceStates intent, as that is required.
|
// 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 {
|
func NewVoice(s *state.State) *Voice {
|
||||||
v := &Voice{
|
v := &Voice{
|
||||||
State: s,
|
State: s,
|
||||||
|
@ -59,6 +62,10 @@ func NewVoice(s *state.State) *Voice {
|
||||||
ErrorLog: defaultErrorHandler,
|
ErrorLog: defaultErrorHandler,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Register the voice intents.
|
||||||
|
s.Gateway.AddIntents(gateway.IntentGuilds)
|
||||||
|
s.Gateway.AddIntents(gateway.IntentGuildVoiceStates)
|
||||||
|
|
||||||
// Add the required event handlers to the session.
|
// Add the required event handlers to the session.
|
||||||
v.closers = []func(){
|
v.closers = []func(){
|
||||||
s.AddHandler(v.onVoiceStateUpdate),
|
s.AddHandler(v.onVoiceStateUpdate),
|
||||||
|
|
Loading…
Reference in a new issue