6
6
import net .dv8tion .jda .api .entities .Guild ;
7
7
import net .dv8tion .jda .api .entities .Message ;
8
8
import net .dv8tion .jda .api .entities .MessageEmbed ;
9
+ import net .dv8tion .jda .api .entities .Role ;
9
10
import net .dv8tion .jda .api .entities .channel .concrete .TextChannel ;
10
11
import net .dv8tion .jda .api .events .interaction .ModalInteractionEvent ;
11
12
import net .dv8tion .jda .api .events .interaction .command .MessageContextInteractionEvent ;
@@ -52,6 +53,7 @@ public final class ReportCommand extends BotCommandAdapter implements MessageCon
52
53
private static final Color AMBIENT_COLOR = Color .BLACK ;
53
54
private final Cache <Long , Instant > authorToLastReportInvocation = createCooldownCache ();
54
55
private final Predicate <String > modMailChannelNamePredicate ;
56
+ private final Predicate <String > configModGroupPattern ;
55
57
private final String configModMailChannelPattern ;
56
58
57
59
/**
@@ -66,6 +68,9 @@ public ReportCommand(Config config) {
66
68
Pattern .compile (config .getModMailChannelPattern ()).asMatchPredicate ();
67
69
68
70
configModMailChannelPattern = config .getModMailChannelPattern ();
71
+
72
+ configModGroupPattern =
73
+ Pattern .compile (config .getHeavyModerationRolePattern ()).asMatchPredicate ();
69
74
}
70
75
71
76
private Cache <Long , Instant > createCooldownCache () {
@@ -177,9 +182,21 @@ private MessageCreateAction createModMessage(String reportReason,
177
182
.setDescription (reportReason )
178
183
.setColor (AMBIENT_COLOR )
179
184
.build ();
180
- return modMailAuditLog .sendMessageEmbeds (reportedMessageEmbed , reportReasonEmbed )
181
- .addActionRow (DiscordClientAction .Channels .GUILD_CHANNEL_MESSAGE .asLinkButton (
182
- "Go to Message" , guild .getId (), reportedMessage .channelID , reportedMessage .id ));
185
+
186
+ MessageCreateAction message =
187
+ modMailAuditLog .sendMessageEmbeds (reportedMessageEmbed , reportReasonEmbed )
188
+ .addActionRow (DiscordClientAction .Channels .GUILD_CHANNEL_MESSAGE .asLinkButton (
189
+ "Go to Message" , guild .getId (), reportedMessage .channelID ,
190
+ reportedMessage .id ));
191
+
192
+ Optional <Role > moderatorRole = guild .getRoles ()
193
+ .stream ()
194
+ .filter (role -> configModGroupPattern .test (role .getName ()))
195
+ .findFirst ();
196
+
197
+ moderatorRole .ifPresent (role -> message .setContent (role .getAsMention ()));
198
+
199
+ return message ;
183
200
}
184
201
185
202
private void sendModMessage (ModalInteractionEvent event , List <String > args ,
0 commit comments