M
M
Mops1072022-01-08 21:02:20
Python
Mops107, 2022-01-08 21:02:20

How to play music in voice chat via discord bot without FFmpeg?

You need to make a command through which the bot will launch the music file in the voice chat in discord.
There is such a code

@bot.command()
async def play(ctx, track):
    channel = ctx.message.author.voice.channel
    if track == "ld":
        song_there = os.path.isfile('ld.mp3')
        await channel.play(source=song_there)
        await ctx.send(f'Сейчас играет: **музыка**')
    else:
        pass

But at startup it says AttributeError: 'VoiceChannel' object has no attribute 'play'
Please help

Answer the question

In order to leave comments, you need to log in

1 answer(s)
T
Timofey Yangin, 2022-01-08
@imducked

there is no play attribute, see discord.py documentation

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question