- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
Traceback (most recent call last):
File "C:\Users\Pradeep Tejwani\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\bot.py", line 892, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\Pradeep Tejwani\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 797, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\Pradeep Tejwani\AppData\Local\Programs\Python\Python38\lib\site-packages\discord\ext\commands\core.py", line 92, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: RuntimeError: PyNaCl library needed in order to use voice
这是我的错误,即使我同时安装了 python 库 pynacl
和 discord.py[voice]
。我尝试了很多次,但仍然遇到同样的错误。我什至将我的库更新到更新的版本,但没有任何改变。
代码:
@bot.command()
async def join(ctx):
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()
await voice.disconnect()
if voice and voice.is_connected():
await voice.move_to(channel)
else:
voice = await channel.connect()
print(f"The bot has connected to {channel}\n")
await ctx.send(f"Joined {channel}")
#leave cmd
@bot.command()
async def leave(ctx):
channel = ctx.message.author.voice.channel
voice = get(bot.voice_clients, guild=ctx.guild)
if voice and voice.is_connected():
await voice.disconnect()
print(f"The bot has left {channel}")
await ctx.send(f"Left {channel}")
else:
print("Bot was told to leave voice channel, but was not in one")
await ctx.send("Don't think I am in a voice channel")
最佳答案
你安装了 PyNaCl 了吗?如果没有,请从 PyPi 下载 PyNaCl。或者安装 Voice Version discord.py的或者在你的控制台输入这个
python3 -m pip install -U discord.py[voice]
还有一个小提示:Discord.py 现在是 1.5.1 版(我不知道你是不是最新的),PyNaCl 现在是 >1.4.0 版
关于python - 运行时错误 : PyNaCl library needed in order to use voice,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/63859231/
import discord import pynacl client = discord.Client() @client.event async def on_ready(): print
我有以下情况: 给定某个客户端计算机上的 Python 应用程序,该应用程序支持多个用户。它对用户密码进行加密和解密。目前最推荐的方法是什么? 尝试使用 PyNaCI 后发现,这不是一个好方法,因为
我有一些代码是用 Python 2.7 编写的,并使用 pynacl,在 mac os x 上运行。目前它的工作方式如下所示,它将加密密码,然后稍后解密。我想知道解密的最后几行是否可以位于单独的 py
我正在使用 PyNaCl 生成 key : nacl.utils.random(nacl.secret.SecretBox.KEY_SIZE) 按键看起来像: b'\xa5\x8bL\xc4\xc0\
我需要在 pyNaCl 中生成签名和私钥并将它们存储在某个地方。之后,我需要能够从字符串加载它们。 这是生成新的 SigningKey 和公钥的代码。 def gen_keys(): glob
我有一个服务器和客户端设置,当客户端连接时,它会发送一个带有用户名和公钥的 JSON 对象。 我当前的代码: private_key = PrivateKey.generate() public_ke
我尝试构建 Dockerfile 但出现了如下错误: pynacl 构建轮失败 这是我的setup.py 文件的样子 FROM python:3.6-alpine
Traceback (most recent call last): File "C:\Users\Pradeep Tejwani\AppData\Local\Programs\Python\Py
Traceback (most recent call last): File "C:\Users\Pradeep Tejwani\AppData\Local\Programs\Python\Py
我正在使用最新版本的 Pycharm: 当我输入这个命令时:pip install -U discord.py[voice] 此错误消息将出现:错误:无法为使用 PEP 517 且无法直接安装的 Py
我正在尝试将私钥/公钥作为 UTF-8 字符串存储在数据库中。问题是当我将它们带回代码时,它们不是正确的类型。作为字节,它们打印相同,按照以下代码: import nacl.utils from na
我正在尝试在 Ubuntu 16.04 上安装 PyNaCl,但出现标题错误;这是整个回溯: Collecting PyNaCl Using cached PyNaCl-1.0.1.tar.gz
我是一名优秀的程序员,十分优秀!