discord.py-self Improper token has been passed

Решил значит попробовать написать селф бота. Исправил кучу ошибок в сурс коде и наконец вышел на ошибку discord.errors.LoginFailure: Improper token has been passed. Что с ней делать - без понятия. Помогите!

import discord
import discord.ext.commands

TOKEN = 'MTI*************.*******************'

SERVER_ID = ................
CHANNEL_ID = ................

client = discord.ext.commands.Bot(command_prefix="!!", self_bot=True)

@client.event
async def on_ready():
    print(f'We have logged in as {client.user}')

@client.event
async def on_message(message):
    if message.channel.id == CHANNEL_ID and message.guild.id == SERVER_ID:
    print(f'{message.author}: {message.content}')

client.run(TOKEN)




2024-04-06 18:44:06 INFO     discord.client Logging in using static token.
2024-04-06 18:44:23 WARNING  discord.utils Info API down. Falling back to manual fetching...
2024-04-06 18:44:24 INFO     discord.http Found user agent Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/120.0.0.0 Safari/537.36, build number 282068.
Traceback (most recent call last):
  File "C:\Users\ermak\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 994, in static_login
    data = await self.get_me()
  File "C:\Users\ermak\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 838, in request
    raise HTTPException(response, 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\ermak\Desktop\sob\main.py", line 22, in <module>
    client.run(TOKEN)
  File "C:\Users\ermak\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 938, in run
    asyncio.run(runner())
  File "C:\Users\ermak\AppData\Local\Programs\Python\Python310\lib\asyncio\runners.py", line 44, in run
    return loop.run_until_complete(main)
  File "C:\Users\ermak\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 649, in run_until_complete
    return future.result()
  File "C:\Users\ermak\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 927, in runner
    await self.start(token, reconnect=reconnect)
  File "C:\Users\ermak\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 857, in start
    await self.login(token)
  File "C:\Users\ermak\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\client.py", line 698, in login
    data = await state.http.static_login(token.strip())
  File "C:\Users\ermak\AppData\Local\Programs\Python\Python310\lib\site-packages\discord\http.py", line 998, in static_login
    raise LoginFailure('Improper token has been passed') from exc
discord.errors.LoginFailure: Improper token has been passed

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