11package net .discordjug .javabot .systems .moderation ;
22
33import net .discordjug .javabot .data .config .BotConfig ;
4- import net .discordjug .javabot .systems .moderation .warn .dao .WarnRepository ;
5- import net .discordjug .javabot .systems .notification .NotificationService ;
64import net .discordjug .javabot .util .Checks ;
75import net .discordjug .javabot .util .Responses ;
86import net .dv8tion .jda .api .Permission ;
1412import net .dv8tion .jda .api .interactions .commands .build .Commands ;
1513import net .dv8tion .jda .api .requests .restaction .WebhookMessageCreateAction ;
1614
17- import java .util .concurrent .ExecutorService ;
18-
1915import javax .annotation .Nonnull ;
2016import javax .annotation .Nullable ;
2117
2218/**
2319 * <h3>This class represents the /kick command.</h3>
2420 */
2521public class KickCommand extends ModerateUserCommand {
26- private final NotificationService notificationService ;
27- private final WarnRepository warnRepository ;
28- private final ExecutorService asyncPool ;
22+ private final ModerationService moderationService ;
2923
3024 /**
3125 * The constructor of this class, which sets the corresponding {@link net.dv8tion.jda.api.interactions.commands.build.SlashCommandData}.
32- * @param notificationService The {@link NotificationService}
3326 * @param botConfig The main configuration of the bot
34- * @param asyncPool The main thread pool for asynchronous operations
35- * @param warnRepository DAO for interacting with the set of {@link Warn} objects.
27+ * @param moderationService Service object for moderating members
3628 */
37- public KickCommand (NotificationService notificationService , BotConfig botConfig , ExecutorService asyncPool , WarnRepository warnRepository ) {
29+ public KickCommand (BotConfig botConfig , ModerationService moderationService ) {
3830 super (botConfig );
39- this .notificationService = notificationService ;
40- this .warnRepository = warnRepository ;
41- this .asyncPool = asyncPool ;
31+ this .moderationService = moderationService ;
4232 setModerationSlashCommandData (Commands .slash ("kick" , "Kicks a member" )
4333 .addOption (OptionType .USER , "user" , "The user to kick." , true )
4434 .addOption (OptionType .STRING , "reason" , "The reason for kicking this user." , true )
@@ -52,8 +42,7 @@ protected WebhookMessageCreateAction<Message> handleModerationUserCommand(@Nonnu
5242 return Responses .replyInsufficientPermissions (event .getHook (), Permission .KICK_MEMBERS );
5343 }
5444 boolean quiet = isQuiet (event );
55- ModerationService service = new ModerationService (notificationService , botConfig , event .getInteraction (), warnRepository , asyncPool );
56- service .kick (target , reason , event .getMember (), event .getChannel (), quiet );
45+ moderationService .kick (target , reason , event .getMember (), event .getChannel (), quiet );
5746 return Responses .success (event .getHook (), "User Kicked" , "%s has been kicked." , target .getAsMention ());
5847 }
5948}
0 commit comments