0
votes

I am working on a discord bot using the discord.py API. I am trying to make the bot join a voice channel and play an mp3 file that is in the same directory. It joins the voice channel but prints the error in the title before playing anything. I was wondering what was causing this error. Relevant code below:

@client.command()
async def playClip(ctx):
    global voice
    channel=ctx.message.author.voice.channel
    voice= get(client.voice_clients, guild=ctx.guild)

    if voice and voice.is_connected():
        await voice.move_to(channel)
    else:
        voice= await channel.connect()

    voice.play(discord.FFmpegPCMAudio("BravoSix.mp3"))
    print("test")
    await voice.disconnect()
1

1 Answers

1
votes

The problem is that the path you gave to the audio file is bad. You have to give it the whole path to the file using single backslashes

voice.play(discord.FFmpegPCMAudio("C:\whereever\the\file\is\BravoSix.mp3"))