Search code examples
pythondiscorddiscord.py

My discord.py bot is not starting because of a KeyError


With the following code that I have for my bot, he's not booting up. I don't understand.

Here is my code (I have put a mystb.in link, because my question had "too much code")

The full traceback:

Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x0000000004005D30>
Traceback (most recent call last):
  File "C:\Users\Bi\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "C:\Users\Bi\AppData\Local\Programs\Python\Python38\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Users\Bi\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 711, in call_soon
    self._check_closed()
  File "C:\Users\Bi\AppData\Local\Programs\Python\Python38\lib\asyncio\base_events.py", line 504, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

And here is the image of what the error shows up like in VSCode.

There is something that I don't understand very well, when I put in a different token it works just perfectly fine.


Solution

  • In fact, I went on replit and the error shew very well : Invalid token.

    My bot just got deleted.