#module 'discord' has no attribute 'Intents'

1 messages · Page 1 of 1 (latest)

warm moth
#

Help with a code

primal linden
potent foxBOT
# warm moth Help with a code

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.

warm moth
#

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

potent foxBOT
#
Error

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

potent foxBOT
# warm moth habe problem mit diesen code have problem with this code: line 9, in <module> ...

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

warm moth
#

When I want to do the first and second step I get an error message : No module named pip

#

@primal linden

warm moth
#

How

thin blaze
warm moth
#

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

thin blaze
#

...

#

try to understand a bit what ur doing

#

pip3 install -U py-cord

#

or only
pip install -U py-cord

warm moth
#

what should I do now ?

thin blaze
#

so try agaon to run ur script

warm moth
#

So start the bot?

primal linden
#

yes...

warm moth
#

line 9, in <module>
intents = discord.Intents.all()
^^^^^^^^^^^^^^^
AttributeError: module 'discord' has no attribute 'Intents'

#

this error still occurs

warm moth
#

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

thin blaze
#

and not pip

#

or just pip and not python pip

#

just use the one working

warm moth
#

how do I use pip3

thin blaze
#

lets do it really simply

#

did it work when you ddid :
pip install -U py-cord

warm moth
#

okay

thin blaze
#

if yes do :
pip uninstall discord.py discord -y
pip install py-cord

warm moth
#

I have now done the 3 commands

#

Can I start the bot now?

thin blaze
#

try

#

if the commands were successful

warm moth
#

no, the error message still appears

thin blaze
warm moth
#

still the same

#

line 5, in <module>
intents = discord.Intents.default()
^^^^^^^^^^^^^^^
AttributeError: module 'discord' has no attribute 'Intents'

thin blaze
warm moth
#

wait

sterile field
#

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'

warm moth
#

what is venv?

sterile field
#

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

warm moth
#

@sterile fieldyou speak germany?

sterile field
#

keep it english so everyone can help

warm moth
#

okay

#

can you talk then I'll show you

sterile field
warm moth
#

I can send you a photo from my phone showing how I start the bot

sterile field
#

just take a screenshot..

warm moth
sterile field
#

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

warm moth
#

and reinstalled py-cord

sterile field
#

show it

warm moth
#
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
sterile field
#

whatever this is, uninstall it

#

same for ezcord

warm moth
#

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

sterile field
#

yea, thats not a thing in pycord

#

check the guide and docs please, what you're looking for are bridge commands

warm moth
sterile field
#

where did you get that code from

#

there are so, so many issues with that

warm moth
#

what should I do ?

#

I made it myself

sterile field
#

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

warm moth
#

I want to use slash commands and not hybrid_command

thin blaze
sterile field
#

yea but somewhere in your code you use that, according to the error

#

it tells you the line. find it, fix it.

warm moth
#

It says that I use hybrid_command, but I don't, weird

thin blaze
sterile field
#

the error says it

#

actually reinstall pycord, it might have been because you had ezcord installed

warm moth
#

thanks for everything my bot works again with slash commands thank you thank you

sterile field
#

you should replace all of those ctx.send with ctx.respond tho

warm moth
#

my bot works again

#

Thanks for your help