简体   繁体   中英

ctx.voice_client.play not playing music — Discord.py

Here I am trying to make a music bot. Currently my bot connects to the voice channel but doesn't play anything. ctx.voice_client.play does nothing, nor does it produce any errors.

These have been my attempted trials, yet none work. What is the problem?

ctx.voice_client.play(source=discord.FFmpegPCMAudio('song0.mp3'))
ctx.voice_client.play(source=discord.FFmpegPCMAudio('song0.mp3', executable='path/to/ffmpeg.exe'))
ctx.voice_client.play(source=discord.FFmpegPCMAudio('song0.mp3', executable='path/to/ffmpeg.exe', before_options = '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', options = '-vn'))
ffmpeg_options = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
ctx.voice_client.play(source=discord.FFmpegPCMAudio('song0.mp3', executable='path/to/ffmpeg.exe', **ffmpeg_options))

Here I am trying to make a music bot. Currently my bot connects to the voice channel but doesn't play anything. ctx.voice_client.play does nothing, nor does it produce any errors.

These have been my attempted trials, yet none work. What is the problem?

ctx.voice_client.play(source=discord.FFmpegPCMAudio('song0.mp3'))
ctx.voice_client.play(source=discord.FFmpegPCMAudio('song0.mp3', executable='path/to/ffmpeg.exe'))
ctx.voice_client.play(source=discord.FFmpegPCMAudio('song0.mp3', executable='path/to/ffmpeg.exe', before_options = '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', options = '-vn'))
ffmpeg_options = {'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
ctx.voice_client.play(source=discord.FFmpegPCMAudio('song0.mp3', executable='path/to/ffmpeg.exe', **ffmpeg_options))

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM