From a821b914c94398a5b47dc6478507b830f39b3670 Mon Sep 17 00:00:00 2001 From: Jared Vititoe Date: Tue, 13 Jan 2026 16:41:36 -0500 Subject: [PATCH] Remove daily adjectives feature --- bot.py | 72 ---------------------------------------------------------- 1 file changed, 72 deletions(-) diff --git a/bot.py b/bot.py index daeaa76..5fb53f4 100644 --- a/bot.py +++ b/bot.py @@ -86,84 +86,12 @@ class CustomBot(commands.Bot): "Ranked Minesweeper" ]) self.remove_command("help") - self.adjectives_data = None async def setup_hook(self): logger.info("Syncing commands...") await self.tree.sync() logger.info("Commands synced!") - # Load adjectives asynchronously - adjectives_path = Path('adjectives.json') - if adjectives_path.exists(): - try: - async with aiohttp.ClientSession() as session: - # Use aiofiles-like approach with asyncio - loop = asyncio.get_event_loop() - self.adjectives_data = await loop.run_in_executor( - None, - lambda: json.loads(adjectives_path.read_text()) - ) - logger.info("Adjectives data loaded successfully") - self.daily_adjective.start() - except Exception as e: - logger.error(f"Failed to load adjectives.json: {e}") - else: - logger.warning("adjectives.json not found, daily adjective task disabled") - - @tasks.loop(time=datetime_time(hour=14)) - async def daily_adjective(self): - try: - channel = self.get_channel(ANNOUNCEMENT_CHANNEL_ID) - if not channel: - logger.error(f"Failed to get announcement channel {ANNOUNCEMENT_CHANNEL_ID}") - return - - if not self.adjectives_data or not self.adjectives_data.get("adjectives"): - logger.warning("No adjectives available") - return - - # Get and remove today's adjective - adjective = self.adjectives_data["adjectives"].pop(0) - - # Create and send embed - embed = discord.Embed( - title="📚 Adjective of the Day", - color=discord.Color.from_rgb(152, 0, 0), - timestamp=datetime.now() - ) - embed.add_field( - name=adjective["word"].capitalize(), - value=adjective["definition"].capitalize(), - inline=False - ) - embed.set_footer(text="Expand your vocabulary!") - - await channel.send(embed=embed) - - # Save updated adjectives list back to file asynchronously - loop = asyncio.get_event_loop() - await loop.run_in_executor( - None, - lambda: Path('adjectives.json').write_text( - json.dumps(self.adjectives_data, indent=4) - ) - ) - - # Reload list if empty - if not self.adjectives_data["adjectives"]: - logger.info("Adjectives list empty, reloading from file") - self.adjectives_data = await loop.run_in_executor( - None, - lambda: json.loads(Path('adjectives.json').read_text()) - ) - except Exception as e: - logger.error(f"Error in daily_adjective task: {e}", exc_info=True) - - @daily_adjective.before_loop - async def before_daily_adjective(self): - await self.wait_until_ready() - @tasks.loop(seconds=STATUS_UPDATE_INTERVAL) async def change_status(self): try: