major-domo-v2/commands/admin
Cal Corum d295f27afe
All checks were successful
Build Docker Image / build (pull_request) Successful in 1m11s
fix: replace broken @self.tree.interaction_check with MaintenanceAwareTree subclass
The previous code attempted to register a maintenance mode gate via
@self.tree.interaction_check inside setup_hook.  That pattern is invalid
in discord.py — interaction_check is an overridable method on CommandTree,
not a decorator.  The assignment was silently dropped, making maintenance
mode a no-op and producing a RuntimeWarning about an unawaited coroutine.

Changes:
- Add MaintenanceAwareTree(discord.app_commands.CommandTree) that overrides
  interaction_check: blocks non-admins when bot.maintenance_mode is True,
  always passes admins through, no-op when maintenance mode is off
- Pass tree_cls=MaintenanceAwareTree to super().__init__() in SBABot.__init__
- Add self.maintenance_mode: bool = False to SBABot.__init__
- Update /admin-maintenance command to actually toggle bot.maintenance_mode
- Add tests/test_bot_maintenance_tree.py with 8 unit tests covering all
  maintenance mode states, admin pass-through, DM context, and missing attr

Closes #82

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-17 12:25:01 -05:00
..
__init__.py fix: remove 226 unused imports across the codebase (closes #33) 2026-02-20 11:35:04 -06:00
league_management.py fix: remove 226 unused imports across the codebase (closes #33) 2026-02-20 11:35:04 -06:00
management.py fix: replace broken @self.tree.interaction_check with MaintenanceAwareTree subclass 2026-03-17 12:25:01 -05:00
users.py fix: remove 226 unused imports across the codebase (closes #33) 2026-02-20 11:35:04 -06:00