0

I recently started making a Discord bot on Python, and I would like to create a music playing option, so I used the function "connect()" which require the library "PyNaCl", so I installed the library and I imported it on my Python program, but when I call the connect() function there is the following error :

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

However I did import the nacl library. How can I use the connect() function ?

By the way this is my program music part :

    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()

Thanks for reading,

Triplaqs.

1 Answers1

0

Try installing it with pip again (pip install PyNaCl)

Ash
  • 1
  • 2
  • Well, I tried many times, it shows that I already have all the library. It still doesn't work. -> Requirement already satisfied: pynacl in c:\users\triplaqs\bot.env\lib\site-packages (1.4.0) Requirement already satisfied: six in c:\users\triplaqs\bot.env\lib\site-packages (from pynacl) (1.16.0) Requirement already satisfied: cffi>=1.4.1 in c:\users\triplaqs\bot.env\lib\site-packages (from pynacl) (1.15.0) Requirement already satisfied: pycparser in c:\users\triplaqs\bot.env\lib\site-packages (from cffi>=1.4.1->pynacl) (2.21) – Triplaqs Jan 15 '22 at 21:36