Skip to content

Commit aabdb29

Browse files
committedFeb 23, 2022
Simplified DM route creation
1 parent 8630f32 commit aabdb29

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed
 

‎application/src/main/java/org/togetherjava/tjbot/commands/reminder/RemindRoutine.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ private static RestAction<ReminderRoute> computeReminderRoute(@NotNull JDA jda,
8989

9090
private static @NotNull RestAction<ReminderRoute> createDmReminderRoute(@NotNull JDA jda,
9191
long authorId) {
92-
return jda.openPrivateChannelById(authorId)
93-
.map(channel -> ReminderRoute.toPrivate(channel, channel.getUser()));
92+
return jda.openPrivateChannelById(authorId).map(ReminderRoute::toPrivate);
9493
}
9594

9695
private static void sendReminderViaRoute(@NotNull RestAction<ReminderRoute> routeAction,
@@ -134,8 +133,8 @@ static ReminderRoute toPublic(@NotNull TextChannel channel, @Nullable User targe
134133
target == null ? null : target.getAsMention());
135134
}
136135

137-
static ReminderRoute toPrivate(@NotNull PrivateChannel channel, @NotNull User target) {
138-
return new ReminderRoute(channel, target,
136+
static ReminderRoute toPrivate(@NotNull PrivateChannel channel) {
137+
return new ReminderRoute(channel, channel.getUser(),
139138
"(Sending your reminder directly, because I was unable to locate"
140139
+ " the original channel you wanted it to be send to)");
141140
}

0 commit comments

Comments
 (0)
Please sign in to comment.