Skip to content

Refactor ban and kick commands to use followup responses instead of respond#183

Merged
dimoschi merged 4 commits intohackthebox:mainfrom
ToxicBiohazard:fix-issue-173
Apr 15, 2026
Merged

Refactor ban and kick commands to use followup responses instead of respond#183
dimoschi merged 4 commits intohackthebox:mainfrom
ToxicBiohazard:fix-issue-173

Conversation

@ToxicBiohazard
Copy link
Copy Markdown
Contributor

@ToxicBiohazard ToxicBiohazard commented Apr 13, 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

Ban and kick commands use follow-up responses instead of respond. Added deferred calls for a better user experience. Updated tests accordingly.

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 Notes

It should fix issue #173

…espond. Added defer calls for better user experience. Updated tests accordingly.
@ToxicBiohazard ToxicBiohazard changed the title Refactor ban and kick commands to use followup responses instead of respond. Added defer calls for better user experience. Updated tests accordingly. Refactor ban and kick commands to use followup responses instead of respond Apr 13, 2026
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 13, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 65.19%. Comparing base (a478095) to head (8f9d577).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #183      +/-   ##
==========================================
+ Coverage   64.73%   65.19%   +0.45%     
==========================================
  Files          52       52              
  Lines        3043     3048       +5     
==========================================
+ Hits         1970     1987      +17     
+ Misses       1073     1061      -12     

☔ 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.

…us failure scenarios

- Removed redundant user not found check in the kick command.
- Added tests for kicking staff members, bot members, self-kicking, and handling HTTP exceptions.
- Enhanced test coverage for ban commands to include user not found scenarios.
- Implemented a check to handle cases where the user is not found in the server before proceeding with the kick operation.
- This enhances error handling and improves user feedback during the kick command execution.
- Added a new test to handle cases where the user to be kicked is not found in the guild.
- Improved existing test to check for users who have left the server, ensuring accurate feedback is provided to moderators.
- Updated assertions to confirm that no kick action is performed when the user is not found.
Copy link
Copy Markdown
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

@dimoschi dimoschi merged commit e681f82 into hackthebox:main Apr 15, 2026
3 checks passed
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