【问题标题】:PyNaCl library needed, imported, but still neededPyNaCl 库需要,已导入,但仍需要
【发布时间】:2022-01-15 11:44:52
【问题描述】:

我最近开始在 Python 上制作 Discord 机器人,我想创建一个音乐播放选项,所以我使用了需要库“PyNaCl”的函数“connect()”,所以我安装了该库并导入它在我的 Python 程序上,但是当我调用 connect() 函数时出现以下错误:

Traceback (most recent call last):
  File "C:\Users\Triplaqs\Documents\BOT DISCORD\discord\client.py", line 343, in _run_event
    await coro(*args, **kwargs)
  File "C:\Users\Triplaqs\Documents\BOT DISCORD\Bot Discord.py", line 92, in on_message
    await message.author.voice.channel.connect()
  File "C:\Users\Triplaqs\Documents\BOT DISCORD\discord\abc.py", line 1277, in connect
    voice = cls(client, self)
  File "C:\Users\Triplaqs\Documents\BOT DISCORD\discord\voice_client.py", line 199, in __init__
    raise RuntimeError("PyNaCl library needed in order to use voice")
RuntimeError: PyNaCl library needed in order to use voice

但是我确实导入了 nacl 库。如何使用 connect() 函数?

顺便说一下,这是我的节目音乐部分:

    if message.content.startswith("!play") or message.content.startswith("!p"):
        if len(message.content.split())==1 :
            await message.channel.send("no song given")

        elif message.author.voice==None:
            await message.channel.send("request user is not in a voice channel")

        else:
            VC=message.author.voice.channel
            await message.author.voice.channel.connect()

感谢阅读,

Triplaqs。

【问题讨论】:

  • this 有帮助吗?

标签: python discord discord.py pynacl


【解决方案1】:

尝试再次使用 pip 安装它(pip install PyNaCl)

【讨论】:

  • 嗯,我试了很多次,说明我已经拥有了所有的库。它仍然不起作用。 -> 已满足要求:c:\users\triplaqs\bot.env\lib\site-packages (1.4.0) 中的 pynacl 已满足要求:c:\users\triplaqs\bot.env\lib\site- 中的六个包(来自 pynacl)(1.16.0) 已满足要求:c:\users\triplaqs\bot.env\lib\site-packages 中的 cffi>=1.4.1(来自 pynacl)(1.15.0) 已满足要求: c:\users\triplaqs\bot.env\lib\site-packages 中的 pycparser(来自 cffi>=1.4.1->pynacl)(2.21)
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2021-03-21
  • 2011-02-06
  • 1970-01-01
  • 2019-01-28
  • 1970-01-01
  • 2018-08-18
相关资源
最近更新 更多