feat: add owner only privelleges

This commit is contained in:
neoarz
2025-09-14 17:02:34 -04:00
parent 2f5e629e26
commit e14eceffc5
2 changed files with 15 additions and 2 deletions

View File

@@ -1,3 +1,4 @@
TOKEN=YOUR_BOT_TOKEN_HERE TOKEN=YOUR_BOT_TOKEN_HERE
PREFIX=YOUR_BOT_PREFIX_HERE PREFIX=YOUR_BOT_PREFIX_HERE
INVITE_LINK=YOUR_BOT_INVITE_LINK_HERE INVITE_LINK=YOUR_BOT_INVITE_LINK_HERE
OWNER_ID=YOUR_BOT_OWNER_ID_HERE

14
bot.py
View File

@@ -124,6 +124,7 @@ class DiscordBot(commands.Bot):
command_prefix=commands.when_mentioned_or(os.getenv("PREFIX")), command_prefix=commands.when_mentioned_or(os.getenv("PREFIX")),
intents=intents, intents=intents,
help_command=None, 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. 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( self.logger.info(
f"Running on: {platform.system()} {platform.release()} ({os.name})" 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.init_db()
await self.load_cogs() await self.load_cogs()
self.status_task.start() self.status_task.start()