Skip to content

Commit 53f8e29

Browse files
committed
show enabled events on player watch add success
1 parent 9db31fd commit 53f8e29

File tree

2 files changed

+22
-2
lines changed

2 files changed

+22
-2
lines changed

src/main/java/vc/commands/WatchCommand.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -217,11 +217,21 @@ private Mono<Message> handlePlayerWatch(final ChatInputInteractionEvent event, f
217217
}
218218
}
219219
userPlayerWatchRepository.write(watch);
220+
StringBuilder eventsList = new StringBuilder();
221+
if (joins) eventsList.append("Joins, ");
222+
if (leaves) eventsList.append("Leaves, ");
223+
if (chats) eventsList.append("Chats, ");
224+
if (deaths) eventsList.append("Deaths, ");
225+
if (kills) eventsList.append("Kills, ");
226+
// Remove trailing comma and space
227+
if (!eventsList.isEmpty()) {
228+
eventsList.setLength(eventsList.length() - 2);
229+
}
220230
return event.createFollowup()
221231
.withEmbeds(populateIdentity(EmbedCreateSpec.builder(), profile)
222232
.color(Color.SEA_GREEN)
223233
.title("Player Watch Added")
224-
.description("You will be DM'd on events for `%s`".formatted(profile.name()))
234+
.description("You will be DM'd on `%s` events for `%s`".formatted(eventsList.toString(), profile.name()))
225235
.thumbnail(profile.getAvatarURL())
226236
.build());
227237
} else if (option.getOption("delete").isPresent()) {

src/main/java/vc/commands/WatchGuildCommand.java

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -327,11 +327,21 @@ private Mono<Message> handlePlayerWatch(final ChatInputInteractionEvent event, f
327327
}
328328
}
329329
guildPlayerWatchRepository.write(watch);
330+
StringBuilder eventsList = new StringBuilder();
331+
if (joins) eventsList.append("Joins, ");
332+
if (leaves) eventsList.append("Leaves, ");
333+
if (chats) eventsList.append("Chats, ");
334+
if (deaths) eventsList.append("Deaths, ");
335+
if (kills) eventsList.append("Kills, ");
336+
// Remove trailing comma and space
337+
if (!eventsList.isEmpty()) {
338+
eventsList.setLength(eventsList.length() - 2);
339+
}
330340
return event.createFollowup()
331341
.withEmbeds(populateIdentity(EmbedCreateSpec.builder(), profile)
332342
.color(Color.SEA_GREEN)
333343
.title("Player Watch Added")
334-
.description("Notifications on watched events for `%s` will be sent to: %s".formatted(profile.name(), channel.getMention()))
344+
.description("Notifications on `%s` events for `%s` will be sent to: %s".formatted(eventsList.toString(), profile.name(), channel.getMention()))
335345
.thumbnail(profile.getAvatarURL())
336346
.build());
337347
} else if (option.getOption("delete").isPresent()) {

0 commit comments

Comments
 (0)