Categorygithub.com/ethanent/discordgo_voicestateupdatequeue
repositorypackage
1.0.0
Repository: https://github.com/ethanent/discordgo_voicestateupdatequeue.git
Documentation: pkg.go.dev

# Packages

No description provided by the author

# README

discordgo_voicestateupdatequeue

Event enhancer and queue for the DiscordGo VoiceStateUpdate event

PkgGoDev

Features

  • 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.)

Install

go get github.com/ethanent/discordgo_voicestateupdatequeue

Use

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.