#One cog gets loaded, but one doesn't
1 messages · Page 1 of 1 (latest)
Commands from 1 cog aren't loading. The setup function there doesnt get executed for some reason
i have 2 cogs (ignore the helpers folder)
this is the owner cog's setup func
this is the partnerships cog's setup func
this is how i load cogs in the bot.py file
but when i run the bot, this happens
i was expecting "Partners cog loaded" to be printed
but it doesnt
as you can see here
and the commands from there dont work too
neither does it appear in the help cmd
all help is appreciated as i cant test the commands ive written due to this 🥲
yea ill do in a bit. someone is helping me in #999317828584874094
they had similar issue
@vale apex ive subclassed commands.bot. this runs in the __init__ function
this is the thing if you are curious
class PartnerAssistant(commands.Bot):
def __init__(self):
super().__init__(command_prefix="!!", intents=intents)
self.db_connected = asyncio.Event()
self.db_conn.start()
try:
for filename in os.listdir("./Cogs"):
if filename.endswith(".py"):
self.load_extension(f"Cogs.{filename[:-3]}")
print(f"-----------{filename[:-3]} Loaded-----------")
self.load_extension("jishaku")
print("Jishaku Initialised")
except:
raise
@tasks.loop(count=1)
async def db_conn(self):
await Tortoise.init(
db_url="sqlite://./database.db",
# db_url=os.getenv("DATABASE_URL"),
modules={"models": ["Helpers.dbmodels"]},
)
await Tortoise.generate_schemas()
self.db_connected.set()
async def close(self):
await Tortoise.close_connections()
await super().close()
print("Closed")
bot = PartnerAssistant()
class bot(commands.Bot):
def init():
super().init()
hmm yea kinda
see this
Hmmmm
Mmmmmm kay
I understand
I had that bug too
But was simple to fix XD
Thou interesting way to laod it
Load it*
yea its good if you have multiple cogs
it only adds the .py files in the Cogs folder
for filename in os.listdir("./Cogs"):
if filename.endswith(".py"):
Yes so then what do u do about classed modules or things
wot? 👀
those are in a different folder
see ive put the dbmodels.py in the Helpers folder
i import them like this
not familiar with c# and c++ tbh 💀
😅 👍
😅
you will learn the more you try out stuff
same lol
ic
Np!
To fix that bug if it later persist when you update
Just strip the cog to scratch and rebuild it
It worked for me
Oh hmm
weird but will try
And the whole cog just didn't wanna load
Same with my admin
I think i have the logs somewhere
something similar might be happening here
After i stripped the system 😅
Thou i am still rebuilding
Life of a developer never ends
Mind if i add you as a friend?@mossy cave
😂
sure
cool
Did you fix it now? I have the same problem. I tried so seperate my bots commands into cogs and one is working, the other isn’t @mossy cave
i had downgraded to 2.0rc1. no issues there
but when i switched back to 2.0 stable, i didnt get the issue again
i had some minor changes in the code, but im not sure what made the issue disappear
maybe an inconsistent bug or smth
I know what results my got to not get loaded and it‘s that I’m importing other python files into my cog but somehow it doesn’t work, I need to find out how to import other py files into another py file, cause just importing it doesn’t work
👀