在Heroku部署Discord音乐bot时遇到困难



我试图制作一个不和音乐机器人并将其部署到Heroku,我试图使用播放命令

async def play(ctx, url):
channel = ctx.message.author.voice.channel
voice = get(bot.voice_clients, guild=ctx.guild)
if voice and voice.is_connected():
await voice.move_to(channel)
else:
voice = await channel.connect()
YDL_OPTIONS = {'format': 'bestaudio', 'noplaylist': 'True'}
FFMPEG_OPTIONS = {
'before_options': '-reconnect 1 -reconnect_streamed 1 -reconnect_delay_max 5', 'options': '-vn'}
if not get(bot.voice_clients, guild=ctx.guild).is_playing():
with YoutubeDL(YDL_OPTIONS) as ydl:
info = ydl.extract_info(url, download=False)
URL = info['url']
get(bot.voice_clients, guild=ctx.guild).play(FFmpegPCMAudio(URL, **FFMPEG_OPTIONS))
get(bot.voice_clients, guild=ctx.guild).is_playing()
await ctx.send('Bot is playing')

但是从Heroku得到错误信息:

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: DownloadError: ERROR: No video formats found; please report this issue on https://yt-dl.org/bug

我试着重新安装youtube-dl,但是它不工作。

如果你能帮我,那就太好了!谢谢。

这个错误是因为你正在使用YTDL, YTDL现在很老了,YTDL的api很老了,所以如果你想为生产制作一个好的音乐机器人,那么使用Lavalink

最适合Lavalink的包装

  • Wavelink
  • Pomice
  • Lavalink
  • Lavasnek_rs

如果您想安装这些包,只需使用pip install<包装器名称>

如果您遇到任何错误,请随时加入帮助服务器

最新更新