diff --git a/leaderboard/leaderboard.py b/leaderboard/leaderboard.py index 96ad090..f0b701d 100644 --- a/leaderboard/leaderboard.py +++ b/leaderboard/leaderboard.py @@ -89,6 +89,20 @@ class Leaderboard(commands.Cog): self.config.register_guild(**default_guild) + async def initialize(self): + """Initialize optional API connection.""" + try: + self.admin_secret = await self.bot.get_shared_api_tokens("ruby_api") + if self.admin_secret.get("admin_secret"): + self.session = aiohttp.ClientSession() + except Exception as e: + log.error(f"Failed to initialize API connection: {e}") + # Don't return anything - initialization is optional + + async def cog_load(self): + """Initialize the cog when it's loaded.""" + await self.initialize() + async def get_user_credits(self, user: discord.Member) -> int: """Get a user's total credits from Red's bank system.""" try: