Event enhancer and queue for the DiscordGo VoiceStateUpdate event
- Cleans up raw events from Discord using an internal cache.
- Transparently handles voice channel moves, providing them to the consumer as a leave then join event.
- Consistently sends events with both GuildID and ChannelID. (Except for the VoiceChannelLeaveUnknownChannel event.)
go get github.com/ethanent/discordgo_voicestateupdatequeue
Create a channel through which to receive VoiceStateEvents.
c := make(chan *queue.VoiceStateEvent)
Create a new VoiceStateEventQueue and give it the channel.
q := queue.NewVoiceStateEventQueue(c)
Add the queue's handler to your session.
// Assuming your *discordgo.Session is called s:
s.AddHandler(q.Handler)
Then you can use the channel to receive VoiceStateEvents while the bot is running.
The events will contain a type (join, leave, leave from untracked channel, settings update) and other associated fields.