         guard let audioData = try self?.decryptPacket(with: Data(bytes: data)) else { return }
         self?.emit(.audioData, with: audioData)
       }catch {
-        guard let isConnected = self?.isConnected, !isConnected else { return }
+        guard let isConnected = self?.isConnected, isConnected else { return }
 
         print("[Sword] Unable to read voice data from guild: \(self?.guildId as Any).")
       }

  */
  func handleDisconnect(for code: Int) {
    guard CloseOP(rawValue: code) != nil else {
      print("[Sword] Voice connection closed with unrecognized response\nCode: \(code)")
      
      return
    }
  }

      self.emit(.connectionClose)
    }
    
    self.heartbeat = nil
    self.isConnected = false
    self.encoder = nil
    
    #if !os(Linux)
    self.session?.disconnect()
    #else
    try? self.session?.close()
    #endif
    
    try? self.udpClient?.close()
  }

}
