【问题标题】:Discord.py Music Bot create_ytdl_player errorDiscord.py 音乐机器人 create_ytdl_player 错误
【发布时间】:2020-08-31 13:36:25
【问题描述】:

我正在编写我的第一个音乐机器人并实现了加入语音聊天,但从 youtube 播放音乐时出现问题。我正在尝试从收到的 YouTube 链接播放音乐并收到错误消息。我试图在 Internet 上找到解决方案,但代码到处都是来自旧文档。这是我的代码:

@client.command()
async def play(ctx, url):
    guild = ctx.message.guild
    voice_client = guild.voice_client
    player = await voice_client.create_ytdl_player(url)
    players[guild.id] = player
    player.start()

控制台出错: AttributeError: 'VoiceClient' 对象没有属性 'create_ytdl_player'

【问题讨论】:

    标签: discord.py


    【解决方案1】:

    自重写 (1.x) 以来,语音客户端的该属性已不存在。我建议您查看 discord.py github 示例,其中包含一个使用 youtube-dl 的音乐机器人

    【讨论】:

      猜你喜欢
      • 2021-05-05
      • 1970-01-01
      • 2021-05-24
      • 2021-04-29
      • 1970-01-01
      • 2018-07-24
      • 1970-01-01
      • 2022-09-29
      • 2019-09-08
      相关资源
      最近更新 更多