cleanup: remove dead maintenance mode artifacts in bot.py (#104) #105

Merged
cal merged 1 commits from ai/major-domo-v2-104 into next-release 2026-03-20 17:49:42 +00:00

25
bot.py
View File

@ -42,7 +42,9 @@ def setup_logging():
# JSON file handler - structured logging for monitoring and analysis
json_handler = RotatingFileHandler(
"logs/discord_bot_v2.json", maxBytes=5 * 1024 * 1024, backupCount=5 # 5MB
"logs/discord_bot_v2.json",
maxBytes=5 * 1024 * 1024,
backupCount=5, # 5MB
)
json_handler.setFormatter(JSONFormatter())
logger.addHandler(json_handler)
@ -120,28 +122,11 @@ class SBABot(commands.Bot):
self.maintenance_mode: bool = False
self.logger = logging.getLogger("discord_bot_v2")
self.maintenance_mode: bool = False
async def setup_hook(self):
"""Called when the bot is starting up."""
self.logger.info("Setting up bot...")
@self.tree.interaction_check
async def maintenance_check(interaction: discord.Interaction) -> bool:
"""Block non-admin users when maintenance mode is enabled."""
if not self.maintenance_mode:
return True
if (
isinstance(interaction.user, discord.Member)
and interaction.user.guild_permissions.administrator
):
return True
await interaction.response.send_message(
"🔧 The bot is currently in maintenance mode. Please try again later.",
ephemeral=True,
)
return False
# Load command packages
await self._load_command_packages()
@ -443,7 +428,9 @@ async def health_command(interaction: discord.Interaction):
embed.add_field(name="Bot Status", value="✅ Online", inline=True)
embed.add_field(name="API Status", value=api_status, inline=True)
embed.add_field(name="Guilds", value=str(guild_count), inline=True)
embed.add_field(name="Latency", value=f"{bot.latency*1000:.1f}ms", inline=True)
embed.add_field(
name="Latency", value=f"{bot.latency * 1000:.1f}ms", inline=True
)
if bot.user:
embed.set_footer(