ERROR discord.ext.commands.bot Ignoring exception in command join

Viewed 30

I wrote a code for discord bot and here some code from my bot:

  async def join_VC(self, ctx, channel):
      id = int(ctx.guild.id)
      if self.vc[id] == None or not self.vc[id].is_connected():
          self.vc[id] = await channel.connect()
          
          if self.vc[id] == None:
              await ctx.send("Ses kanalına bağlanılamıyor.")
              return
      else:
          await self.vc[id].move_to(channel)

  @ commands.command(
      name="join",
      alias=["j"],
      help=""
  )
  async def join(self, ctx):
      if ctx.author.voice:
          userChannel = ctx.author.voice.channel
          await self.join_VC(ctx,userChannel)
          await ctx.send(f'{userChannel}')
          
      else:
          await ctx.send("X")

but when i join de vc and call the bot with join command bot give me this error:

ERROR    discord.ext.commands.bot Ignoring exception in command join
Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/ext/commands/core.py",

line 190, in wrapped ret = await coro(*args, **kwargs) File "/home/pi/Desktop/X/music_cog.py", line 141, in join await self.join_VC(ctx,userChannel) File "/home/pi/Desktop/X/music_cog.py", line 64, in join_VC if self.vc[id] == None or not self.vc[id].is_connected(): KeyError: 1015921742172139540

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

Traceback (most recent call last):
  File "/usr/local/lib/python3.9/dist-packages/discord/ext/commands/bot.py",

line 1347, in invoke await ctx.command.invoke(ctx) File "/usr/local/lib/python3.9/dist-packages/discord/ext/commands/core.py", line 986, in invoke await injected(*ctx.args, **ctx.kwargs) # type: ignore File "/usr/local/lib/python3.9/dist-packages/discord/ext/commands/core.py", line 199, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: KeyError: 1015921742172139540

How can i fix this error?

0 Answers
Related