Add User in Guild check for inductions#736
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
There was a problem hiding this comment.
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.
CarrotManMatt
left a comment
There was a problem hiding this comment.
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. |
CarrotManMatt
left a comment
There was a problem hiding this comment.
Using the ID as the argument guarantees that the function uses the correctly retrieved member object, rather than the passed in one.
There was a problem hiding this comment.
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.
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'