Skip to content

fix(bot): prevent duplicate persistent error notifications on command check failures - #47

Merged
espdesign merged 1 commit into
developfrom
fix/duplicate-error-notification
Sep 24, 2026
Merged

espdesign merged 1 commit into
developfrom
fix/duplicate-error-notification

Conversation

@espdesign

Copy link
Copy Markdown
Collaborator

Description

Fixes an issue where users without required command permissions received two simultaneous error notifications—one temporary auto-dismissing toast and one persistent followup notification that remained on screen indefinitely.

Closes #46

Summary of Changes

  1. Fallback Guard in DggPmBot.on_tree_error (bot.py):
    • Check command._has_any_error_handlers() to suppress duplicate dispatch if a cog or command-level error handler (cog_app_command_error) already handled the error.
    • Avoid blanket suppression on deferred interactions so unhandled errors occurring after deferral are still dispatched.
  2. Followup Auto-Dismissal Targeting (error_handler.py):
    • Pass wait=True to interaction.followup.send(..., wait=True) so discord.py returns the WebhookMessage instead of None.
    • Pass the returned message to menu_manager.schedule_toast_dismissal, allowing ephemeral followup errors to be cleanly auto-dismissed.
  3. Automated Regression Tests (test_error_handling.py):
    • Added end-to-end command check failure pipeline test verifying single response dispatch.
    • Added test ensuring followup messages are awaited with wait=True and scheduled for dismissal.
    • Verified that unhandled errors on deferred interactions still send followup error toasts.

Verification

  • Ran full test suite via make check (397 tests passing, ruff lint and format check clean).

… check failures

Guard DggPmBot.on_tree_error against re-dispatching when commands have error handlers, pass wait=True to interaction.followup.send to ensure dismissal targeting, and add regression tests.

Closes #46
@espdesign
espdesign merged commit 684cdcc into develop Sep 24, 2026
8 checks passed
@espdesign
espdesign deleted the fix/duplicate-error-notification branch September 24, 2026 22:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Duplicate persistent error notification on missing command permissions

1 participant