title: how to play gtts mp3 file in discord voice channel the user is in (discord.py)
body: <p>Like the title I need to play a gtts file into a voice channel what is the easiest way to do this? I am using python 3.7. Here is my code so far:</p>
  <pre><code>@client.command(name=&quot;repeat&quot;)
  async def repeat(context):
    import gtts, ffmpeg
    from discord.ext import commands
    # grab the user who sent the command
    user = context.message.author
    voice_channel = user.voice.voice_channel
    channel = None
    # only play music if user is in a voice channel
    if voice_channel != None:
      await ctx.send(f&quot;What do you want to say, type cancel to cancel:&quot;)
          
      def check(msg):
        return msg.author == ctx.author and msg.channel == ctx.channel
          
      try:
        msg = await client.wait_for(&quot;message&quot;, check=check, timeout=120)
    
      except asyncio.TimeoutError:
        await ctx.send(&quot;Sorry, you didn't reply in time!&quot;)
        
      if(msg.content == 'cancel'):
        return
      
      tts = gtts.gTTS(str(msg.content), lang=&quot;en&quot;)
      tts.save(&quot;text.mp3&quot;)
      
      # grab user's voice channel
      channel = voice_channel.name
      await client.say('User is in channel: '+ channel)
      # create StreamPlayer
      vc = await client.join_voice_channel(voice_channel)
      player = vc.create_ffmpeg_player('text.mp3', after=lambda: print('done'))
      player.start()
      while not player.is_done():
        await asyncio.sleep(1)
        # disconnect after the player has finished
        player.stop()
        await vc.disconnect()
      else:
        await client.say('User is not in a channel.')
  </code></pre>
  <p>I am still new to making bots on discord so my code looks like a dumpster fire, I am currently working on fixing/compacting my code. once again I am using python 3.7</p>