@inlap70

Traceback (most recent call last): File «botrun.py», line 14, in Как исправить?

Пытаюсь запустить бота через bat файл, выводит ошибку:

Traceback (most recent call last):
File "botrun.py", line 14, in
bot.run(os.getenv('TOKEN'))
File "C:\Users\User\Desktop\proj\venv\lib\site-packages\discord\client.py", line 723, in run
return future.result()
File "C:\Users\User\Desktop\proj\venv\lib\site-packages\discord\client.py", line 702, in runner
await self.start(*args, **kwargs)
File "C:\Users\User\Desktop\proj\venv\lib\site-packages\discord\client.py", line 666, in start
await self.connect(reconnect=reconnect)
File "C:\Users\User\Desktop\proj\venv\lib\site-packages\discord\client.py", line 601, in connect
raise PrivilegedIntentsRequired(exc.shard_id) from None
discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.
Exception ignored in:
Traceback (most recent call last):
File "D:\Python\lib\asyncio\proactor_events.py", line 116, in del
self.close()
File "D:\Python\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "D:\Python\lib\asyncio\base_events.py", line 719, in call_soon
self._check_closed()
File "D:\Python\lib\asyncio\base_events.py", line 508, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed

Мой код:

import discord
from discord.ext import commands
import os

bot = commands.Bot(commands_prefix='$', intents=discord.Intents.all())

@bot.event
async def on_ready():
print('System_connected')
print('DataBase_connected...OK')

bot.run(os.getenv('TOKEN'))

Что делать??
Я вообще ничего не понимаю...
  • Вопрос задан
  • 122 просмотра
Решения вопроса 1
shurshur
@shurshur
Сисадмин, просто сисадмин...
Он же всё пишет:

discord.errors.PrivilegedIntentsRequired: Shard ID None is requesting privileged intents that have not been explicitly enabled in the developer portal. It is recommended to go to https://discord.com/developers/applications/ and explicitly enable the privileged intents within your application's page. If this is not possible, then consider disabling the privileged intents instead.

При создании бота запрошены privileged intents, но они не были включены в Developer Portal. Их надо включить, либо (что лучше) убрать из кода intents до тех пор, пока они не будут действительно нужны.
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы