From 47896ecac7cb9084131072b0c387756deb9f296a Mon Sep 17 00:00:00 2001 From: Funky Waddle Date: Sun, 29 Jun 2025 02:24:00 -0500 Subject: [PATCH] Update main. Add db and guild attributes. Add reload_cog command --- __main__.py | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/__main__.py b/__main__.py index d5afd0f..8791867 100644 --- a/__main__.py +++ b/__main__.py @@ -28,14 +28,14 @@ class FunkyBot(commands.Bot): intents=bot_intents ) self.log_handler = BotLog("bot.log") - self.db = Db(db_conn_str, True) - self.guild = None + self.db = Db(db_conn_str, False) self.guild_id = guild_id + self.guild = None self.dev_mode = dev_mode == "1" async def on_ready(self): print(f"Logged in as {self.user.name}") - self.guild = await Guilds().get_guild(self) + self.guild = Guilds().get_guild(self) await self.tree.sync(guild=self.guild) async def async_cleanup(self): @@ -61,7 +61,7 @@ class FunkyBot(commands.Bot): if role is not None: if role not in member.roles: await member.add_roles(role) - await channel.send(f"Another Penguin has joined the Collective. Everyone say hi to {member.mention}!") + await channel.send(f"{role.mention} Another Penguin has joined the Collective. Say hi to {member.mention}!") async def load_cogs(self): for filename in os.listdir("./cogs"): @@ -69,6 +69,12 @@ class FunkyBot(commands.Bot): await self.load_extension(f"cogs.{filename[:-3]}") print(f"Loaded {filename[:-3]}") + @commands.command() + async def reload_cog(self, ctx, cog): + ctx.message.delete() + await self.reload_cog(ctx, f"cogs.{cog}") + print(f"Reloaded {cog}") + async def main(): bot = FunkyBot()