【问题标题】:'VoiceClient' object has no attribute 'create_ffmpeg_player'“VoiceClient”对象没有属性“create_ffmpeg_player”
【发布时间】:2020-02-29 00:32:00
【问题描述】:

本帖(how do i make my discord.py bot play mp3 in voice channel?)推荐这段代码:

player = vc.create_ffmpeg_player('vuvuzela.mp3', after=lambda: print('done'))

这是我的台词:

self.player = await self.vc.create_ffmpeg_player('song.mp3')

但是在做同样的事情之后,我得到了这个错误:

Traceback (most recent call last):
  File "/home/lam/miniconda3/lib/python3.7/site-packages/discord/client.py", line 270, in _run_event
    await coro(*args, **kwargs)
  File "bot.py", line 41, in on_message
    self.player = await self.vc.create_ffmpeg_player('song.mp3')
AttributeError: 'VoiceClient' object has no attribute 'create_ffmpeg_player'

他们是否更改了文档?

【问题讨论】:

    标签: python discord discord.py


    【解决方案1】:

    这是我的例子,我觉得这看起来很熟悉。该示例是使用 discord.py 版本 0.16.12 编写的。因此,如果您使用 discord.py 重写,那么该代码将不起作用。这是文档的链接,他们在其中解释了语音https://discordpy.readthedocs.io/en/v1.2.4/migrating.html#voice-changes 的变化@第一个示例就是您要查找的内容。

    【讨论】:

      猜你喜欢
      • 2021-02-04
      • 2020-11-11
      • 1970-01-01
      • 1970-01-01
      • 2012-12-01
      • 2021-08-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多