0
@client.command()
async def join(ctx):
    if ctx.message.author.voice:
        channel = ctx.author.voice.channel
        await channel.connect()

I've been working on a discord bot for practicing purposes and I've been stuck on getting it to join a voice channel. I have PyNaCl installed and I've swapped between 1.3.0 and 1.4.0 with pip to see if it'd make a difference and nothing. I made sure libsodium was installed thinking that would solve the issue but I'm still getting the same errors whenever I try to make the bot join a voice channel.

I'm willing to try out any other troubleshooting methods and fixes but I've scoured stackoverflow with no results so far.

import discord
from discord.ext import commands
import random
import youtube_dl
from discord import channel


try:
    import nacl.secret
    has_nacl = True
except ImportError:
    has_nacl = False

These are the imports to my work, I tried just using just 'import.nacl' with no results either.

Traceback (most recent call last):
  File "C:\Users\Fernando\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\bot.py", line 903, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Fernando\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\core.py", line 859, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Fernando\AppData\Roaming\Python\Python37\site-packages\discord\ext\commands\core.py", line 94, 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

Thank you for your time!

  • 1
    You might have multiple Python installations installed. – Tin Nguyen Oct 05 '20 at 09:17
  • @TinNguyen I reinstalled all versions of python and it did resolve the issue. It did turn out I had 3.6 as well as 3.7 installed on my PC. Sorry for the late reply and thank you for your time! – Fernando Flores Oct 09 '20 at 19:05

0 Answers0