Skip to content

🐛 Fix interaction failures stemming from bot reset / state loss#175

Merged
dimoschi merged 3 commits intomainfrom
bugfix/interaction-fail
Mar 24, 2026
Merged

🐛 Fix interaction failures stemming from bot reset / state loss#175
dimoschi merged 3 commits intomainfrom
bugfix/interaction-fail

Conversation

@0xRy4n
Copy link
Member

@0xRy4n 0xRy4n commented Mar 20, 2026

Types of changes

What types of changes does your code introduce?
Put an x in the boxes that apply.

  • Bugfix (non-breaking change which fixes an issue).
  • New feature (non-breaking change which adds functionality).
  • Breaking change (fix or feature that would cause existing functionality not to work as expected).
  • Documentation Update (if none of the other choices applies).

Proposed changes

View interactions would fail if the bot had been reset or lost connection causing some staff actions to result in "This interaction failed" when clicking on buttons in views.

  • BanDecisionView buttons now use specific custom IDs instead of static ones
  • BanDecisionView constructor only takes ban ID and reconstructs additional context at call time
  • Callbacks use defer() before continuing processing
  • View registration

Checklist

Put an x in the boxes that apply.

  • I have read and followed the CONTRIBUTING.md
    doc.
  • Lint and unit tests pass locally with my changes.
  • I have added the necessary documentation (if appropriate).

Additional context

@codecov
Copy link

codecov bot commented Mar 20, 2026

Codecov Report

❌ Patch coverage is 80.76923% with 20 lines in your changes missing coverage. Please review.
✅ Project coverage is 61.74%. Comparing base (131c32b) to head (8cc73bb).

Files with missing lines Patch % Lines
src/bot.py 15.78% 16 Missing ⚠️
src/helpers/ban.py 20.00% 4 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #175      +/-   ##
==========================================
+ Coverage   59.38%   61.74%   +2.36%     
==========================================
  Files          50       50              
  Lines        2903     2941      +38     
==========================================
+ Hits         1724     1816      +92     
+ Misses       1179     1125      -54     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

return
user_id = ban.user_id

member = await self.bot.get_member_or_user(interaction.guild, user_id)
Copy link
Contributor

@dimoschi dimoschi Mar 23, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What if get_member_or_user returns None? Should we try...except here?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Down to preference I guess. The function itself has a bunch of exception handling to log the various possible errors, but there is no way to really handle/correct for it (beyond the logging), so it may make sense to let the exception bubble up. Whatever you prefer, really

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could make sense if member is None to return and not even try to unban. Right now, it would seem to the moderators that the member that wasn't found has been unbanned/denied.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fair point, I will change that

Copy link
Contributor

@dimoschi dimoschi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you @0xRy4n for taking good care!

@dimoschi dimoschi merged commit 0f08c66 into main Mar 24, 2026
7 checks passed
@dimoschi dimoschi deleted the bugfix/interaction-fail branch March 24, 2026 06:22
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.

2 participants