1
0
mirror of https://github.com/stryan/mumble-discord-bridge.git synced 2024-11-14 11:45:40 -05:00

only care about joins, not mutes/deafens

This commit is contained in:
stryan 2021-01-03 20:29:56 -05:00
parent f1f59116b5
commit 8257bf55ab

View File

@ -139,6 +139,18 @@ func guildCreate(s *discordgo.Session, event *discordgo.GuildCreate) {
func voiceUpdate(s *discordgo.Session, event *discordgo.VoiceStateUpdate) {
if event.GuildID == BridgeConf.GID {
if event.ChannelID == BridgeConf.CID {
//check to see if this is actually a new user
g, err := s.State.Guild(event.GuildID)
if err != nil {
log.Println("Could not find guild while checking VoiceStateUpdate")
return
}
for _, vs := range g.VoiceStates {
if vs.UserID == event.UserID {
//user is already in channel (and is probably just muting/etc), ignore
return
}
}
log.Println("user joined watched discord channel")
u, err := s.User(event.UserID)
if err != nil {