Merge pull request 'fix: implement actual maintenance mode flag in /admin-maintenance (#28)' (#62) from ai/major-domo-v2-28 into next-release

Reviewed-on: #62
This commit is contained in:
cal 2026-03-03 22:08:19 +00:00
commit 88ad58fa12
2 changed files with 274 additions and 250 deletions

17
bot.py
View File

@ -80,11 +80,28 @@ class SBABot(commands.Bot):
)
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()

File diff suppressed because it is too large Load Diff