Не могу понять в чем проблема БОТ ДИСКОРДА discord.py python

Traceback (most recent call last):
  File "C:\Users\nsbm\AppData\Roaming\Python\Python310\site-packages\discord\http.py", line 300, in static_login
    data = await self.request(Route('GET', '/users/@me'))
  File "C:\Users\nsbm\AppData\Roaming\Python\Python310\site-packages\discord\http.py", line 254, in request
    raise HTTPException(r, data)
discord.errors.HTTPException: 401 Unauthorized (error code: 0): 401: Unauthorized

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

Traceback (most recent call last):
  File "C:\Users\nsbm\Desktop\pipka", line 16, in <module>
    client.run('token')
  File "C:\Users\nsbm\AppData\Roaming\Python\Python310\site-packages\discord\client.py", line 723, in run
    return future.result()
  File "C:\Users\nsbm\AppData\Roaming\Python\Python310\site-packages\discord\client.py", line 702, in runner
    await self.start(*args, **kwargs)
  File "C:\Users\nsbm\AppData\Roaming\Python\Python310\site-packages\discord\client.py", line 665, in start
    await self.login(*args, bot=bot)
  File "C:\Users\nsbm\AppData\Roaming\Python\Python310\site-packages\discord\client.py", line 511, in login
    await self.http.static_login(token.strip(), bot=bot)
  File "C:\Users\nsbm\AppData\Roaming\Python\Python310\site-packages\discord\http.py", line 304, in static_login
    raise LoginFailure('Improper token has been passed.') from exc
discord.errors.LoginFailure: Improper token has been passed.
Exception ignored in: <function _ProactorBasePipeTransport.__del__ at 0x000001D02529A290>
Traceback (most recent call last):
  File "C:\Program Files\Python310\lib\asyncio\proactor_events.py", line 116, in __del__
    self.close()
  File "C:\Program Files\Python310\lib\asyncio\proactor_events.py", line 108, in close
    self._loop.call_soon(self._call_connection_lost, None)
  File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 750, in call_soon
    self._check_closed()
  File "C:\Program Files\Python310\lib\asyncio\base_events.py", line 515, in _check_closed
    raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed
[Finished in 823ms]

CODE

import discord

class MyClient(discord.Client):
    async def on_ready(self):
        print('Logged on as', self.user)

    async def on_message(self, message):
        # don't respond to ourselves
        if message.author == self.user:
            return

        if message.content == 'ping':
            await message.channel.send('pong')

client = MyClient()
client.run('token')

Ответы (1 шт):

Автор решения: Corrygan

raise LoginFailure('Improper token has been passed.') from exc Данная ошибка говорит о том, что у вас ошибка в токене, проверьте его.

→ Ссылка