eric-yeung / Discord-Bot

Discord Bot written in Python that plays music in your voice channel
43 stars 36 forks source link

Not working #3

Closed gentoocat closed 3 years ago

gentoocat commented 3 years ago
Traceback (most recent call last):
  File "C:\Users\Tenet\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped
    ret = await coro(*args, **kwargs)
  File "C:/Users/Tenet/AppData/Local/Programs/Python/Python39/ezv2.py", line 31, in play
    voice = get(client.voice_clients, guild=ctx.guild)
NameError: name 'get' is not defined

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File "C:\Users\Tenet\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\bot.py", line 939, in invoke
    await ctx.command.invoke(ctx)
  File "C:\Users\Tenet\AppData\Local\Programs\Python\Python39\lib\site-packages\discord\ext\commands\core.py", line 863, in invoke
    await injected(*ctx.args, **ctx.kwargs)
  File "C:\Users\Tenet\AppData\Local\Programs\Python\Python39\lib\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: NameError: name 'get' is not defined
myusernameDiscord commented 3 years ago

Replace voice = get(client.voice_clients, guild=ctx.guild) with voice = discord.utils.get(client.voice_clients, guild=ctx.guild)