diff --git a/main.go b/main.go index c3cae8c..4e0f697 100644 --- a/main.go +++ b/main.go @@ -303,7 +303,6 @@ func enqueuePlay(user *discordgo.User, guild *discordgo.Guild, coll *SoundCollec mutex.Unlock() playSound(play, nil) } - go checkReconnectCounter() } // Play a sound @@ -461,38 +460,6 @@ func setIdleStatus() { } } -func checkReconnectCounter() { - mutex.Lock() - if len(queues) > 0 { - mutex.Unlock() - return - } - if rcCounter >= 20 { - reconnect() - rcCounter = 0 - } else { - rcCounter++ - } - mutex.Unlock() -} - -func reconnect() { - log.Infoln("Reconnecting web socket.") - err := discord.Close() - if err != nil { - log.WithFields(log.Fields{ - "error": err, - }).Error("Failed to close connection.") - return - } - err = discord.Open() - if err != nil { - log.WithFields(log.Fields{ - "error": err, - }).Fatal("Failed to create discord websocket connection") - } -} - func onMessageCreate(s *discordgo.Session, m *discordgo.MessageCreate) { if m.Content == "ping" || m.Content == "pong" { // If the message is "ping" reply with "Pong!"