昨天的问题解决了,但是歌曲还是没有播放,所以我又来写了
您对处理此错误有什么建议吗?
我奇怪地指定了文件的路径吗?
import youtube_dl
import discord
intents = discord.Intents.default()
client = discord.Client(intents=intents)
@client.event
async def on_ready():
print('켜짐')
print(client.user.id)
print('--------------------------')
@client.event
async def on_message(message):
if message.content.startswith('핑크야 들어와'):
await message.author.voice.channel.connect()
await message.channel.send('빠밤')
if message.content.startswith('핑크야 나가'):
for vc in client.voice_clients:
if vc.guild == message.guild:
voice = vc
await voice.disconnect()
await message.channel.send('힝...')
if message.content.startswith('핑크야 재생'):
for vc in client.voice_clients:
if vc.guild == message.guild:
voice = vc
url = message.content.split(" ")[1]
option = {
'outtmpl': "file/" + url.split('=')[1] + ".mp3"
}
with youtube_dl.YoutubeDL(option) as ydl:
ydl.download([url])
info = ydl.extract_info(url, download=False)
title = info["title"]
voice.play(discord.FFmpegPCMAudio("file/" + url.split('=')[1] + ".mp3"))
await message.channel.send(title + "재생할게!")
client.run("")
这是错误代码。
我需要做什么才能找到目录?
如果您能告诉我我可以参考的网站,我将不胜感激
file/rok2YK_D6Oc.mp3: No such file or directory