выдёт ошибку и не запускает бота.
код:
import discord
import json
from discord.ext import commands
intents = discord.Intents.default()
intents.message_content = True
file = open('config.json', 'r')
config = json.load(file)
bot = commands.Bot(config['prefix'], intents=intents)
@bot.command(name='ping')
async def ping(ctx):
await ctx.send(f'{ctx.author.mention}pong')
bot.run(config['token'])
ошибка:
2023-03-30 07:14:26 INFO discord.client logging in using static token
Traceback (most recent call last):
File "main.py", line 18, in <module>
bot.run(token)
File "C:\Users\matve\Desktop\BOT\venv\lib\site-packages\discord\client.py", line 860, in run
asyncio.run(runner())
File "C:\Program Files\Python38\lib\asyncio\runners.py", line 43, in run
return loop.run_until_complete(main)
File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 616, in run_until_complete
return future.result()
File "C:\Users\matve\Desktop\BOT\venv\lib\site-packages\discord\client.py", line 849, in runner
await self.start(token, reconnect=reconnect)
File "C:\Users\matve\Desktop\BOT\venv\lib\site-packages\discord\client.py", line 778, in start
await self.connect(reconnect=reconnect)
File "C:\Users\matve\Desktop\BOT\venv\lib\site-packages\discord\client.py", line 704, 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: <function _ProactorBasePipeTransport.__del__ at 0x000001CD081FBE50>
Traceback (most recent call last):
File "C:\Program Files\Python38\lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
File "C:\Program Files\Python38\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 719, in call_soon
self._check_closed()
File "C:\Program Files\Python38\lib\asyncio\base_events.py", line 508, in _check_closed
raise RuntimeError('Event loop is closed')
RuntimeError: Event loop is closed