def voice_connect(chan, encrypted = true)
      chan = channel(chan.resolve_id)
      server_id = chan.server.id
      @should_encrypt_voice = encrypted

      if @voices[chan.id]
        debug('Voice bot exists already! Destroying it')
        @voices[chan.id].destroy
        @voices.delete(chan.id)
      end

      debug("Got voice channel: #{chan}")

      @should_connect_to_voice[server_id] = chan
      @gateway.send_voice_state_update(server_id.to_s, chan.id.to_s, false, false)

      debug('Voice channel init packet sent! Now waiting.')

      sleep(0.05) until @voices[server_id]
      debug('Voice connect succeeded!')
      @voices[server_id]
    end
def voice_connect(chan, encrypted = true)
      chan = channel(chan.resolve_id)
      server_id = chan.server.id
      @should_encrypt_voice = encrypted

      if @voices[chan.id]
        debug('Voice bot exists already! Destroying it')
        @voices[chan.id].destroy
        @voices.delete(chan.id)
      end

      debug("Got voice channel: #{chan}")

      @should_connect_to_voice[server_id] = chan
      @gateway.send_voice_state_update(server_id.to_s, chan.id.to_s, false, false)

      debug('Voice channel init packet sent! Now waiting.')

      sleep(0.05) until @voices[server_id]
      debug('Voice connect succeeded!')
      @voices[server_id]
    end
Connects to a voice channel, initializes network connections and returns the {Voice::VoiceBot} over which audio
 data can then be sent. After connecting, the bot can also be accessed using {#voice}. If the bot is already
 connected to voice, the existing connection will be terminated - you don't have to call
 {Discordrb::Voice::VoiceBot#destroy} before calling this method.
 @param chan [Channel, Integer, #resolve_id] The voice channel to connect to.
 @param encrypted [true, false] Whether voice communication should be encrypted using RbNaCl's SecretBox
   (uses an XSalsa20 stream cipher for encryption and Poly1305 for authentication)
 @return [Voice::VoiceBot] the initialized bot over which audio data can then be sent.