title: discord.errors.ClientException: Already connected to a voice channel
body: <p>So I made a piece of code with discord.py that plays an audio file when a user joins a voice channel. The problem is that I get the warning above. I think this is because when the bot joins it sees itself joining and can't join again. I have tried to solve this with the commented line of code, but that doesn't seem to work. The full error will be below the code. I'll only paste the code needed for this aspect of my bot, because the problem lies with this piece of code and not the rest. I also get this websocket closing warning, but do'nt know if it's important.</p>
  <p><strong>Code:</strong></p>
  <pre><code>@bot.event
  async def on_voice_state_update(member: discord.Member, before, after):
      vc_before = before.channel
      vc_after = after.channel
      path_mp3 = &quot;Tutturuu.mp3&quot;
      path_ffmpeg = r&quot;C:\ffmpeg\bin\ffmpeg.exe&quot;
      if vc_before == vc_after:
          return
      if vc_before is None:  # and member.display_name != discord.ClientUser.name:
          channel = member.voice.channel
          vc = await channel.connect()
          time.sleep(.5)
          vc.play(discord.FFmpegPCMAudio(executable=path_ffmpeg, source=path_mp3))
          with audioread.audio_open(path_mp3) as f:
              time.sleep(f.duration)
          await vc.disconnect()
      elif vc_after is None:
          return
      else:
          channel = member.voice.channel
          vc = await channel.connect()
          time.sleep(.5)
          vc.play(discord.FFmpegPCMAudio(executable=path_ffmpeg, source=path_mp3))
          with audioread.audio_open(path_mp3) as f:
              time.sleep(f.duration)
          await vc.disconnect()
  </code></pre>
  <p><strong>Full error:</strong>
  Ignoring exception in on_voice_state_update
  Traceback (most recent call last):
  File &quot;C:\Users\yorbe\OneDrive\Documenten\Folders\Gerbinbot_3000\venv\lib\site-packages\discord\client.py&quot;, line 333, in _run_event
  await coro(*args, **kwargs)
  File &quot;C:/Users/yorbe/OneDrive/Documenten/Folders/Gerbinbot_3000/main.py&quot;, line 109, in on_voice_state_update
  vc = await channel.connect()
  File &quot;C:\Users\yorbe\OneDrive\Documenten\Folders\Gerbinbot_3000\venv\lib\site-packages\discord\abc.py&quot;, line 1115, in connect
  raise ClientException('Already connected to a voice channel.')
  discord.errors.ClientException: Already connected to a voice channel.
  websocket connection is closing.
  websocket connection is closing.
  websocket connection is closing.</p>