From e14eceffc5b05a9ef10f99676f38956cbae57da4 Mon Sep 17 00:00:00 2001 From: neoarz Date: Sun, 14 Sep 2025 17:02:34 -0400 Subject: [PATCH] feat: add owner only privelleges --- .env.example | 3 ++- bot.py | 14 +++++++++++++- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/.env.example b/.env.example index 5d8f5b2..70971ae 100644 --- a/.env.example +++ b/.env.example @@ -1,3 +1,4 @@ TOKEN=YOUR_BOT_TOKEN_HERE PREFIX=YOUR_BOT_PREFIX_HERE -INVITE_LINK=YOUR_BOT_INVITE_LINK_HERE \ No newline at end of file +INVITE_LINK=YOUR_BOT_INVITE_LINK_HERE +OWNER_ID=YOUR_BOT_OWNER_ID_HERE diff --git a/bot.py b/bot.py index 373f544..d2d0909 100644 --- a/bot.py +++ b/bot.py @@ -124,6 +124,7 @@ class DiscordBot(commands.Bot): command_prefix=commands.when_mentioned_or(os.getenv("PREFIX")), intents=intents, help_command=None, + owner_id=int(os.getenv("OWNER_ID")) if os.getenv("OWNER_ID") else None, ) """ This creates custom bot variables so that we can access these variables in cogs more easily. @@ -190,7 +191,18 @@ class DiscordBot(commands.Bot): self.logger.info( f"Running on: {platform.system()} {platform.release()} ({os.name})" ) - self.logger.info("-------------------") + + if self.owner_id: + try: + owner = await self.fetch_user(self.owner_id) + self.logger.info(f"Owner found: {owner.name} (ID: {self.owner_id})") + except discord.NotFound: + self.logger.warning(f"Owner ID {self.owner_id} not found - owner commands may not work") + except Exception as e: + self.logger.error(f"Error fetching owner: {e}") + else: + self.logger.warning("No owner ID set - owner commands will not work") + await self.init_db() await self.load_cogs() self.status_task.start()