Skip to content

Commit 6a963fb

Browse files
committed
Fix CR comments
1 parent 2e2c3c3 commit 6a963fb

File tree

2 files changed

+4
-8
lines changed

2 files changed

+4
-8
lines changed

application/src/main/java/org/togetherjava/tjbot/commands/moderation/ReportCommand.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -191,10 +191,8 @@ private MessageCreateAction createModMessage(String reportReason,
191191

192192
Optional<Role> moderatorRole = guild.getRoles()
193193
.stream()
194-
.map(Role::getName)
195-
.filter(configModGroupPattern)
196-
.findFirst()
197-
.map(name -> guild.getRolesByName(name, false).get(0));
194+
.filter(role -> configModGroupPattern.test(role.getName()))
195+
.findFirst();
198196

199197
moderatorRole.ifPresent(role -> message.setContent(role.getAsMention()));
200198

application/src/main/java/org/togetherjava/tjbot/commands/moderation/modmail/ModMailCommand.java

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -157,10 +157,8 @@ private MessageCreateAction createModMessage(SlashCommandInteractionEvent event,
157157
Optional<Role> moderatorRole = event.getGuild()
158158
.getRoles()
159159
.stream()
160-
.map(Role::getName)
161-
.filter(configModGroupPattern)
162-
.findFirst()
163-
.map(name -> event.getGuild().getRolesByName(name, false).get(0));
160+
.filter(role -> configModGroupPattern.test(role.getName()))
161+
.findFirst();
164162

165163
moderatorRole.ifPresent(role -> message.setContent(role.getAsMention()));
166164

0 commit comments

Comments
 (0)