【问题标题】:Issue with playing audio - discord.py播放音频的问题 - discord.py
【发布时间】:2020-08-31 09:45:49
【问题描述】:

好的,所以我将它添加到我的机器人中:

if message.content.startswith('!test'):
    voice = await client.join_voice_channel(message.author.voice.voice_channel)
    args = message.content.split(" ")
    betterargs = " ".join(args[1:])
    player = await voice.create_ytdl_player('https://www.youtube.com/watch?v=' + betterargs)
    player.start()

但是当我输入 !test 并在聊天中结束 youtube 链接时,机器人会加入频道,但它给了我这个错误

Ignoring exception in on_message
Traceback (most recent call last):
  File "C:\Users\server\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 307, in _run_event
    yield from getattr(self, event)(*args, **kwargs)
  File "noob.py", line 99, in on_message
    voice = await client.join_voice_channel(message.author.voice.voice_channel)
  File "C:\Users\server\AppData\Local\Programs\Python\Python36-32\lib\site-packages\discord\client.py", line 3211, in join_voice_channel

有人知道怎么回事吗?

【问题讨论】:

    标签: python discord discord.py


    【解决方案1】:

    该属性 (create_ytdl_player) 已在 discord.py 的重写版本 (1.x) 中删除。请查看 discord.py github 存储库中的示例以获取更多信息。 (它有一个使用 youtube-dl 的音乐机器人示例)

    【讨论】:

      猜你喜欢
      • 2021-04-09
      • 1970-01-01
      • 2021-06-05
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2021-02-13
      相关资源
      最近更新 更多