0
votes

I am coding my first music bot and implemented joining voice chat, but there was a problem when playing music from youtube. I'm trying to play music from the received YouTube link and getting an error. I tried to find a solution on the Internet, but everywhere the code is from the old documentation. Here is my code:

@client.command()
async def play(ctx, url):
    guild = ctx.message.guild
    voice_client = guild.voice_client
    player = await voice_client.create_ytdl_player(url)
    players[guild.id] = player
    player.start()

Error in the console: AttributeError: 'VoiceClient' object has no attribute 'create_ytdl_player'

1

1 Answers

0
votes

That property of voice clients has not existed ever since rewrite (1.x). I would reccomend you to take a look at the discord.py github examples, which one contains a music bot that uses youtube-dl