Skip to content

Commit 9fadf60

Browse files
committed
CR readability with split args
1 parent 21a1880 commit 9fadf60

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

application/src/main/java/org/togetherjava/tjbot/features/tophelper/TopHelpersAssignmentRoutine.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -288,17 +288,18 @@ private void reportRoleManageSuccess(StringSelectInteractionEvent event) {
288288
public void onButtonClick(ButtonInteractionEvent event, List<String> args) {
289289
event.deferEdit().queue();
290290
String name = args.getFirst();
291+
List<String> otherArgs = args.subList(1, args.size());
291292

292293
switch (name) {
293-
case YES_MESSAGE_BUTTON_NAME -> prepareAnnouncement(event, args);
294+
case YES_MESSAGE_BUTTON_NAME -> prepareAnnouncement(event, otherArgs);
294295
case NO_MESSAGE_BUTTON_NAME -> reportFlowFinished(event, "not posting an announcement");
295296
case CANCEL_BUTTON_NAME -> reportFlowFinished(event, "cancelled");
296297
default -> throw new AssertionError("Unknown button name: " + name);
297298
}
298299
}
299300

300301
private void prepareAnnouncement(ButtonInteractionEvent event, List<String> args) {
301-
List<Long> topHelperIds = args.stream().skip(1).map(Long::parseLong).toList();
302+
List<Long> topHelperIds = args.stream().map(Long::parseLong).toList();
302303

303304
event.getGuild().retrieveMembersByIds(topHelperIds).onError(error -> {
304305
logger.warn("Failed to retrieve top-helper data for automatic assignment", error);

0 commit comments

Comments
 (0)