|
8 | 8 | import net.dv8tion.jda.api.interactions.commands.build.OptionData; |
9 | 9 | import net.dv8tion.jda.api.interactions.commands.build.SubcommandData; |
10 | 10 | import net.javadiscord.javabot.data.config.BotConfig; |
| 11 | +import net.javadiscord.javabot.systems.moderation.ModerateUserCommand; |
11 | 12 | import net.javadiscord.javabot.systems.moderation.ModerationService; |
12 | 13 | import net.javadiscord.javabot.systems.moderation.warn.dao.WarnRepository; |
13 | 14 | import net.javadiscord.javabot.systems.moderation.warn.model.WarnSeverity; |
14 | 15 | import net.javadiscord.javabot.systems.notification.NotificationService; |
| 16 | +import net.javadiscord.javabot.util.Checks; |
15 | 17 | import net.javadiscord.javabot.util.Responses; |
16 | 18 |
|
17 | 19 | import java.util.concurrent.ExecutorService; |
@@ -66,13 +68,17 @@ public void execute(@NotNull SlashCommandInteractionEvent event) { |
66 | 68 | Responses.replyGuildOnly(event).queue(); |
67 | 69 | return; |
68 | 70 | } |
| 71 | + if(!Checks.hasStaffRole(botConfig, event.getMember())) { |
| 72 | + Responses.replyStaffOnly(event, botConfig.get(event.getGuild())).queue(); |
| 73 | + return; |
| 74 | + } |
69 | 75 | User target = userMapping.getAsUser(); |
70 | 76 | WarnSeverity severity = WarnSeverity.valueOf(severityMapping.getAsString().trim().toUpperCase()); |
71 | 77 | if (target.isBot()) { |
72 | 78 | Responses.warning(event, "You cannot warn bots.").queue(); |
73 | 79 | return; |
74 | 80 | } |
75 | | - boolean quiet = event.getOption("quiet", false, OptionMapping::getAsBoolean); |
| 81 | + boolean quiet = ModerateUserCommand.isQuiet(botConfig, event); |
76 | 82 | ModerationService service = new ModerationService(notificationService, botConfig, event, warnRepository, asyncPool); |
77 | 83 | service.warn(target, severity, reasonMapping.getAsString(), event.getMember(), event.getChannel(), quiet); |
78 | 84 | Responses.success(event, "User Warned", "%s has been successfully warned.", target.getAsMention()).queue(); |
|
0 commit comments