【发布时间】:2021-04-07 08:44:46
【问题描述】:
代码
voiceChannel = discord.utils.get(ctx.guild.voice_channels,name='CBT')
voice = discord.utils.get(client.voice_clients, guild=ctx.guild)
await voiceChannel.connect()
ydl_opts = {
'format': 'bestaudio/best',
'postprocessors': [{
'key':'FFmpegExtractAudio',
'preferredcodec':'mp3',
'preferredquality':'192',
}],
}
with youtube_dl.YoutubeDL(ydl_opts) as ydl:
ydl.download([url])
for file in os.listdir("./"):
if file.endswith(".mp3"):
os.rename(file, "song.mp3")
我认为这给了我一个问题
voice.play(discord.FFmpegPCMAudio('song.mp3'))
错误信息:
AttributeError: 'NoneType' object has no attribute 'play'
【问题讨论】:
标签: python python-3.x discord.py