S
S
student_py2021-11-16 23:04:19
Sublime Text
student_py, 2021-11-16 23:04:19

Error when launching .bat when creating a discord bot, what to do and how to solve?

Hello, I really need help. I'm making a discord bot, a very simple one that only executes commands. I'm new to this, so I'm asking for help here.
So, the first time I did everything like the rules, I run the .bat file and the bot is online, I was delighted, but not for long.
Later I started adding commands and ended up with an error, nothing works. Apparently the problem is in the venv module, because there is a "client.py" file in which there are a lot of errors in different lines, I did not climb there, because I will make it even worse.
I reinstalled the venv module several times, or whatever it's called, I don't know.


The error itself is in the console.

Traceback (most recent call last):
File "C:\Users\artem\Desktop\bebra\bot\botrun.py", line 15, in
bot.run(os.getenv("TOKEN"))
File "C:\Users\artem\Desktop\bebra\venv\lib\site-packages\discord\client.py", line 723, in run
return future.result()
File "C:\Users\artem\Desktop\ bebra\venv\lib\site-packages\discord\client.py", line 702, in runner
await self.start(*args, **kwargs)
File "C:\Users\artem\Desktop\bebra\venv\lib \site-packages\discord\client.py", line 666, in start
await self.connect(reconnect=reconnect)
File "C:\Users\artem\Desktop\bebra\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 "C:\Users\artem\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 116, in __del__
self.close()
File "C:\Users\artem\AppData\Local\Programs\Python\Python310\lib\asyncio\proactor_events.py", line 108, in close
self._loop.call_soon(self._call_connection_lost, None)
File "C:\Users\artem\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 745, in call_soon
self._check_closed()
File "C:\Users\artem\AppData\Local\Programs\Python\Python310\lib\asyncio\base_events.py", line 510, in _check_closed raise RuntimeError
('Event loop is closed')
RuntimeError: Event loop is closed

the code:

import discord
from discord.ext import commands
import os

bot = commands.Bot(command_prefix="!", intents=discord.Intents.all())

@bot.event
async def on_ready():
  print("тест")





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

Answer the question

In order to leave comments, you need to log in

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question