#module 'discord' has no attribute 'Intents'
1 messages · Page 1 of 1 (latest)
.tag idw
Saying it doesn't work or asking what's wrong with this code is not helpful for yourself or others.
Describe what you expect and/or tried (with your code), and what isn't going right.
Please provide any errors you get for optimal assistance.
import discord
import os
from dotenv import load_dotenv
Laden der .env-Datei
load_dotenv()
Intents setzen
intents = discord.Intents.all()
bot = discord.Bot(intents=intents)
@bot.event
async def on_ready():
print(f"{bot.user} ist online")
Erweiterungen (Cogs) laden
if name == "main":
for filename in os.listdir("cogs"):
if filename.endswith(".py"):
bot.load_extension(f"cogs.{filename[:-3]}")
# Bot starten
bot.run(os.getenv("TOKEN"))
habe problem mit diesen code
have problem with this code: line 9, in <module>
intents = discord.Intents.all()
^^^^^^^^^^^^^^^
AttributeError: module 'discord' has no attribute 'Intents' there comes the error
.tag install pycord
Flag 'delete' is required and missing
1. Uninstall discord.py or any other forks of discord.py you might have with the namespace discord.
python -m pip uninstall discord.py discord -y
2a. Install py-cord
python -m pip install py-cord
2b. Update py-cord
python pip install -U py-cord
Installing other builds:
Note: You need to have git installed. Use ?tag git to find out how to install git.
Updating the module to master branch (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord
.tag install
1. Uninstall discord.py or any other forks of discord.py you might have with the namespace discord.
python -m pip uninstall discord.py discord -y
2a. Install py-cord
python -m pip install py-cord
2b. Update py-cord
python pip install -U py-cord
Installing other builds:
Note: You need to have git installed. Use ?tag git to find out how to install git.
Updating the module to master branch (unstable):
pip install -U git+https://github.com/Pycord-Development/pycord
When I want to do the first and second step I get an error message : No module named pip
@primal linden
Try with pip3
How
pip3 install …
pip3 install .
[notice] A new release of pip is available: 24.3.1 -> 25.1.1
[notice] To update, run: C:\Users\merli\AppData\Local\Programs\Python\Python312\python.exe -m pip install --upgrade pip
ERROR: Invalid requirement: '…': Expected package name at the start of dependency specifier
...
try to understand a bit what ur doing
pip3 install -U py-cord
or only
pip install -U py-cord
he has now installed that
what should I do now ?
so try agaon to run ur script
So start the bot?
yes...
line 9, in <module>
intents = discord.Intents.all()
^^^^^^^^^^^^^^^
AttributeError: module 'discord' has no attribute 'Intents'
this error still occurs
did u do all of that ?
For 1 and 2 I get an error message when I try to run it : .venv\Scripts\python.exe: No module named pip : So I can't execute number 1 and 2 because an error message comes up
i told you to use pip3
and not pip
or just pip and not python pip
just use the one working
how do I use pip3
so
lets do it really simply
did it work when you ddid :
pip install -U py-cord
okay
if yes do :
pip uninstall discord.py discord -y
pip install py-cord
no, the error message still appears
what error message ? the same as the first one ?
still the same
line 5, in <module>
intents = discord.Intents.default()
^^^^^^^^^^^^^^^
AttributeError: module 'discord' has no attribute 'Intents'
are you using visual studio code ?
wait
Whatever you installed is completely wrong
because both discord.py and py-cord have discord.Intents
do you use a venv
module 'discord' has no attribute 'Intents'
what is venv?
a virtual environment. if you see here the python install you use is in a venv.
so you probably are running the install commands in the wrong place
it would help if you showed us more of anything
show how you start the bot
@sterile fieldyou speak germany?
keep it english so everyone can help
make a screenshot of this.
I can send you a photo from my phone showing how I start the bot
just take a screenshot..
you do know doing it this way is both harder, takes longer, and is harder to read right
and i mean you installed the wrong thing, twice at that
uninstall discord and discord.py and install ONLY py-cord
show it
Package Version
------------------- -----------
aiocache 0.12.3
aiohappyeyeballs 2.4.6
aiohttp 3.11.12
aiosignal 1.3.2
aiosqlite 0.21.0
app-commands 0.1.0
async-timeout 5.0.1
attrs 25.1.0
chat_exporter 2.8.4
click 7.1.2
click-aliases 1.0.1
click-default-group 1.2.4
click-help-colors 0.9.4
colorama 0.4.6
commonmark 0.9.1
datadispatch 1.0.0
dotenv 0.9.9
emoji 2.14.1
ezcord 0.7.2
frozenlist 1.5.0
grapheme 0.6.0
greenlet 3.2.1
idna 3.10
iniconfig 2.1.0
multidict 6.1.0
packaging 24.2
pip 24.3.1
pluggy 1.5.0
propcache 0.2.1
py-cord 2.6.1
Pygments 2.19.1
pytest 8.3.5
python-dateutil 2.9.0.post0
python-dotenv 1.0.1
pytz 2025.2
PyYAML 6.0.2
rich 9.13.0
six 1.17.0
SQLAlchemy 1.4.54
tabulate 0.8.10
task 0.2.5
tasks 2.8.0
typing-extensions 3.10.0.2
yarl 1.18.3
youtube-dl 2021.12.17
discord.errors.ExtensionFailed: Extension 'cogs.ticket' raised an error: AttributeError: module 'discord.ext.commands' has no attribute 'hybrid_command'
this is now displayed in my ticket.py file as an error
yea, thats not a thing in pycord
check the guide and docs please, what you're looking for are bridge commands
well somewhere you're trying to use hybrid_command so dont do that
and you are not showing all imports because you are using @slash_command without ever importing it
I want to use slash commands and not hybrid_command
there is no hybrid_command
yea but somewhere in your code you use that, according to the error
it tells you the line. find it, fix it.
It says that I use hybrid_command, but I don't, weird
then ur not using pycord
check the line it tells you use it at.
the error says it
actually reinstall pycord, it might have been because you had ezcord installed
thanks for everything my bot works again with slash commands thank you thank you
you should replace all of those ctx.send with ctx.respond tho