2.5 KiB
2.5 KiB
| id | type | title | tags | importance | confidence | created | updated | relations | ||||||||||||||||||||||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 729df25e-abb1-4b3a-afe5-1f2b5fb8cd50 | workflow | PR review: major-domo-v2#62 — maintenance mode flag (REQUEST_CHANGES) |
|
0.6 | 0.8 | 2026-03-03T18:04:48.164825+00:00 | 2026-03-03T18:04:48.550062+00:00 |
|
Review Summary
PR #62: fix: implement actual maintenance mode flag in /admin-maintenance (#28)
Verdict: REQUEST_CHANGES (could not post — Gitea blocks self-review)
Key Bug Found: Double ephemeral message on maintenance gate
When @self.tree.interaction_check returns False, discord.py dispatches CheckFailure to the registered @bot.tree.error handler (on_app_command_error). The existing handler does NOT handle CheckFailure, so it falls to the else branch, which:
- Logs the error as "Unhandled command error" (incorrect)
- Sends a second ephemeral followup: "❌ An unexpected error occurred." since
is_done()is True
Per discord.py docs: "If this function returns False, the invocation does not happen and the function's error handlers are called with a CheckFailure."
Fix Required
Add CheckFailure handling in bot.py on_app_command_error:
elif isinstance(error, discord.app_commands.CheckFailure):
if not interaction.response.is_done():
await interaction.response.send_message(
"❌ You don't have permission to run this command.", ephemeral=True
)
Files Reviewed
bot.py: Addedself.maintenance_mode: bool = Falsein__init__, nestedmaintenance_checkfunction registered via@self.tree.interaction_checkinsetup_hookcommands/admin/management.py: Addedself.bot.maintenance_mode = is_enabling, logging; rest is Black formatter reformatting
Other Notes
self.bot.maintenance_modeis not type-safe (self.bot: commands.Botdoesn't declare the attribute) — minor- No tests added for the new blocking behavior
- Core logic is correct; admins pass through in maintenance mode, non-Members also blocked in DMs