I am honestly confused, this worked as intended in all tests.
when the bot is online it does correctly check if the bot is ready too.
However it doesn't produce any output in real world usage and i have no idea why.
Here is the file:
from main import Boot
from discord.ext import commands
class Ready(commands.Cog):
def __init__(self, boot: Boot):
self.boot = boot
self.has_run = False
@commands.Cog.listener()
async def on_ready(self):
"""defines what the bot does once cache is loaded"""
if self.has_run:
return
print(f'Logged on as {self.boot.user}!')
member_counter = 0
real_guild_ids = []
delete_guilds = []
stored_guild_ids = await self.boot.db.call_all_server_ids()
for guild in self.boot.guilds:
real_guild_ids.append((guild.id,))
member_counter += guild.member_count
for guild_ID in stored_guild_ids:
if guild_ID not in real_guild_ids:
delete_guilds.append(guild_ID[0])
await self.boot.db.delete_many_servers(delete_guilds)
print(f"\nBooty monitors the activity of {member_counter} Discord members \n"
f"and is used on {len(self.boot.guilds)} Discord servers!")
self.has_run = True
def setup(boot: Boot):
boot.add_cog(Ready(boot))
PS: "boot" or "Boot" is my bot class, cause it's avatar is a boot and its name is booty. It kicks people. just think of it as "bot"