#๐Ÿ”’ Module problem?

47 messages ยท Page 1 of 1 (latest)

random fern
#

Hello when I run my main.py file there is this error message :

Traceback (most recent call last):
  File "c:\Users\Desktop\RB\main.py", line 6, in <module>
    bot = commands.Bot(command_prefix='+', intents=discord.Intents.all())
          ^^^^^^^^^^^^
AttributeError: module 'discord.ext.commands' has no attribute 'Bot'```
last sandBOT
#

@random fern

Python help channel opened

Remember to:

  • Ask your Python question, not if you can ask or if there's an expert who can help.
  • Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
  • Explain what you expect to happen and what actually happens.

:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.

lusty mantle
#

how did you install discord module

random fern
lusty mantle
#

run pip show discord.py

random fern
#

yes

#

then?

lusty mantle
#

give the output

#

not like I can magically imagine the command output that printed out

random fern
#
Version: 2.3.2
Summary: A Python wrapper for the Discord API
Home-page: https://github.com/Rapptz/discord.py
Author: Rapptz
Author-email:
License: MIT
Location: C:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages
Requires: aiohttp
Required-by: discord.js```
lusty mantle
#

discord.js???

#

!pypi discord.js

last sandBOT
random fern
#

wait it's a mistake

#

i have this :

Version: 2.3.2
Summary: A Python wrapper for the Discord API
Home-page: https://github.com/Rapptz/discord.py
Author: Rapptz
Author-email:
License: MIT
Location: C:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages
Requires: aiohttp
Required-by:```
lusty mantle
#

ok, (tbf, the naming of that module is so confusing lol

#

I was like why th it have js in python

#

it should have name as discord-simple but whatever

#

!paste

last sandBOT
#
Pasting large amounts of code

If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/

After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.

lusty mantle
#

don't send your token btw

random fern
#
import discord 
import os
from discord.ext import commands

bot = commands.Bot(command_prefix='+', intents=discord.Intents.all())


@bot.event
async def on_ready():
    print(f"{bot.user.name} est en ligne !")
    for file in os.listdir("./cogs"):
        if file.endswith(".py"):
            name = file[:-3]
            await bot.load_extension(f"cogs.{name}")


if __name__ == "__main__":
    bot.run(TOKEN)```
lusty mantle
#

mhh I don't have the error

random fern
#

yes i don't understand too...

#

btw is there a command to see installed modules please?

lusty mantle
#

pip list

#

go to C:\Users\AppData\Local\Programs\Python\Python312\Lib\site-packages/discord/ext/commands/bot.py

#

and send the file

#

or run dir(commands)

random fern
#

alr

#

when i go to the commands folder i only see this

lusty mantle
#

...

#

just this 2?...

#

pip uninstall discord.py

last sandBOT
lusty mantle
#

and pip install discord.py==2.3.2

random fern
#

ok

#

thank you so much it worked !!!!!!!!

lusty mantle
#

it basically for some reason, most of your package file in discord/ext/commands were deleted

random fern
#

ohhhh

#

yea i see

random fern
#

!close

last sandBOT
#
Python help channel closed

This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.