#command file load error for bot
26 messages · Page 1 of 1 (latest)
2023-09-07 13:17:01 ERROR discord.client Ignoring exception in on_ready
Traceback (most recent call last):
File "D:\PYTHON\Python Interface\lib\site-packages\discord\client.py", line 441, in _run_event
await coro(*args, **kwargs)
File "d:\Projects\Discord BOT (PYTHON)\main.py", line 29, in on_ready
await bot.load_extension(f"{cmd_file.name[:-3]}")
File "D:\PYTHON\Python Interface\lib\site-packages\discord\ext\commands\bot.py", line 1011, in load_extension
raise errors.ExtensionNotFound(name)
discord.ext.commands.errors.ExtensionNotFound: Extension 'math_cmd' could not be loaded.
This is the error messgae
This is settings.py
This is the setup function in math_cmd
I'm pretty sure you need to load com.{cmd_file.stem}
(cmd_file.stem is the file's name without the file extension)
It is working. You just have a bug in your extension file. You can't import commands from discord
oh
You should read the error messages
i read it and it said the error was in com.math_cmd, so i thought there was another error in the code
It is... but it has to do with the code in your math_cmd extension
One of your imports in that file doesn't work
These are the only imports in it
You can't import commands from discord
Commands is a module and it's not included in the discord module, so you have to import discord.commands directly
oh
@maiden inletIt worked, thx for the help..
hey can you please explain why I had to use com. (folder name) with the file name?
So it knows what package to import the module from.
yeah but I have already done that in settings.py in cmds variable