-
-
Notifications
You must be signed in to change notification settings - Fork 89
Migrate kick, ban and unban command #244
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Do i still get credits @Zabuzard |
Of course. Look at the commit history, the first commit is still by you. |
Ok thank you. |
application/src/main/java/org/togetherjava/tjbot/commands/moderation/BanCommand.java
Outdated
Show resolved
Hide resolved
Should i try and fix this |
You cant contribute to this branch since you lack write permission. Ill just take over and finish this quickly. |
Can I get write permission? |
Github unfortunately does not allow that. Otherwise I would have continued in your original PR. |
Once this gets merged, @Zabuzard will send you an invite to our GitHub team and you will be able to get write access to the base repository itself. |
Ok thank you. |
c57f5d4
to
1ee5544
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah all looks good.
@Tais993 @java-coding-prodigy Can you approve this |
@RealYusufIsmail Please check out this branch and do all the tests from the checklist I just added. Blocking this PR until everything has been tested. |
Ok will I do when i go home |
Just curious, why is |
Utility-enum-pattern. The safest option to forbid creation of instances, safer than |
@Zabuzard the bot can not dm users who have there dms disabled for non-friends I have tested it |
application/src/main/java/org/togetherjava/tjbot/commands/moderation/UnbanCommand.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/moderation/KickCommand.java
Outdated
Show resolved
Hide resolved
application/src/main/java/org/togetherjava/tjbot/commands/moderation/UnbanCommand.java
Outdated
Show resolved
Hide resolved
gets rid of code duplication (as flagged by sonar)
* introduced helper method `handleChecks` where all the preconditions are checked (reason, permissions, ...)
* this allows to give selected roles the ability to use moderation commands without giving them the ability to use them without the bot. * for example staff assistants could kick users with the bot, but not without the bot * that way, we can force them to go through the bot instead of using Discord GUI or other bots * which gives us more control and visibility
bff063f
to
8b48e47
Compare
Kudos, SonarCloud Quality Gate passed! |
Merging since 7 days after last unapproved code change. |
Overview
Continuation from #196 .
Adds the
ban
,kick
andunban
commands.Partially implements #63 and #64 .
Role based instead of Permissions
The moderation commands for this bot are role based instead of being based on permissions. For that, the config introduces two new entries:
This allows us to give roles, for example Staff Assistant the possibility to kick(mute, delete-messages, ...) without actually having permission to do so in Discord. That way, we can force them to use the bot instead of other bots or the Discord GUI - making it easier for us to control the flow and in particular give visibility through audit logs, since all actions have to go through our bot now.
Test Checklist
Before merging, we now have to test the following scenarios:
Base cases:
Permissions:
Interaction power:
DM:
Reason:
Logic: