Skip to content

Add User in Guild check for inductions#736

Merged
MattyTheHacker merged 5 commits intomainfrom
fix-induct-user-check
Mar 24, 2026
Merged

Add User in Guild check for inductions#736
MattyTheHacker merged 5 commits intomainfrom
fix-induct-user-check

Conversation

@MattyTheHacker
Copy link
Member

Fixes an issue where if the induct-user context command is run on a user who has left the server, the command will fail with an exception:
❌ ERROR | (non_silent_user_induct) 'User' object has no attribute 'roles'

@MattyTheHacker MattyTheHacker self-assigned this Mar 22, 2026
@MattyTheHacker MattyTheHacker added the bug Something isn't working label Mar 22, 2026
@MattyTheHacker MattyTheHacker added the sync Request bots to automatically keep this PR up to date with it's base branch label Mar 22, 2026
Copilot AI review requested due to automatic review settings March 22, 2026 21:57
@codecov
Copy link

codecov bot commented Mar 22, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Adds guardrails to the induction context-menu commands so they don’t crash when the selected user is no longer in the main guild (fixing the reported 'User' object has no attribute 'roles' failure mode).

Changes:

  • Add “user still in main guild” checks to the “Induct User” context command.
  • Add the same check to the “Silently Induct User” context command.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Copy link
Member

@CarrotManMatt CarrotManMatt left a comment

Choose a reason for hiding this comment

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

Can this not be moved into the top of self._perform_induction function so that the check does not have to be repeated? Or is there a place where _perform_induction is called and this check is not supposed to happen?

@MattyTheHacker
Copy link
Member Author

Can this not be moved into the top of self._perform_induction function so that the check does not have to be repeated? Or is there a place where _perform_induction is called and this check is not supposed to happen?

done - does mean that the check will run when it won't always need to, but I imagine the performance hit will be minimal.

Copy link
Member

@CarrotManMatt CarrotManMatt left a comment

Choose a reason for hiding this comment

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

Using the ID as the argument guarantees that the function uses the correctly retrieved member object, rather than the passed in one.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

Pull request overview

Copilot reviewed 1 out of 1 changed files in this pull request and generated 1 comment.


💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@MattyTheHacker MattyTheHacker merged commit 3d9dfb7 into main Mar 24, 2026
17 checks passed
@MattyTheHacker MattyTheHacker deleted the fix-induct-user-check branch March 24, 2026 00:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working sync Request bots to automatically keep this PR up to date with it's base branch

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants