最近,我开始在Python上创建一个不和谐的机器人,我想创建一个音乐播放选项,所以我使用了函数" connect()“,它需要库"PyNaCl",所以我安装了这个库,并将它导入到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()谢谢你的阅读
三叉戟。
发布于 2022-01-15 13:07:07
再次尝试用pip安装它(pip安装PyNaCl)
https://stackoverflow.com/questions/70721096
复制相似问题