From 8257bf55ab3291c6f1b8b1154ba8c234d761e9f2 Mon Sep 17 00:00:00 2001 From: Steve Date: Sun, 3 Jan 2021 20:29:56 -0500 Subject: [PATCH] only care about joins, not mutes/deafens --- handlers.go | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/handlers.go b/handlers.go index 376fc06..4c08e39 100644 --- a/handlers.go +++ b/handlers.go @@ -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 {