@@ -86,6 +86,9 @@ private Mono<Message> handleChatWatch(final ChatInputInteractionEvent event, fin
8686 return error (event , "Channel option is required to add a watch" );
8787 }
8888 var channel = channelOption .get ();
89+ if (!testPermissions (event .getInteraction ().getGuildId ().get ().asString (), channel )) {
90+ return error (event , "Bot must have permissions to send messages in: " + channel .getMention ());
91+ }
8992 String keyword = addOption .getOption ("keyword" )
9093 .flatMap (ApplicationCommandInteractionOption ::getValue )
9194 .map (ApplicationCommandInteractionOptionValue ::asString )
@@ -153,11 +156,8 @@ private Mono<Message> handleChatWatch(final ChatInputInteractionEvent event, fin
153156 return event .createFollowup ()
154157 .withEmbeds (EmbedCreateSpec .builder ()
155158 .color (Color .SEA_GREEN )
156- .description ("""
157- Watch added!
158-
159- Notifications on watched events will be sent to: %s
160- """ .formatted (channel .getMention ()))
159+ .title ("Chat Watch Added" )
160+ .description ("Notifications on chats containing `%s` will be sent to: %s" .formatted (keyword , channel .getMention ()))
161161 .build ());
162162 } else if (option .getOption ("delete" ).isPresent ()) {
163163 var deleteOption = option .getOption ("delete" ).get ();
@@ -174,12 +174,13 @@ private Mono<Message> handleChatWatch(final ChatInputInteractionEvent event, fin
174174 guildChatWatchRepository .delete (watch );
175175 return event .createFollowup ()
176176 .withEmbeds (EmbedCreateSpec .builder ()
177+ .title ("Chat Watch Deleted" )
177178 .color (Color .SEA_GREEN )
178- .description ("Watch deleted!" )
179+ .description ("Chat Watch for `%s` deleted!" . formatted ( keyword ) )
179180 .build ());
180181 }
181182 }
182- return error (event , "No watch found for `" + keyword + "`" );
183+ return error (event , "No chat watch found for `%s`" . formatted ( keyword ) );
183184 } else if (option .getOption ("list" ).isPresent ()) {
184185 var watches = guildChatWatchRepository .getByGuildId (event .getInteraction ().getGuildId ().get ().asString ());
185186 Collections .sort (watches , (a , b ) -> {
@@ -207,7 +208,7 @@ private Mono<Message> handleChatWatch(final ChatInputInteractionEvent event, fin
207208 }
208209 return event .createFollowup ()
209210 .withEmbeds (EmbedCreateSpec .builder ()
210- .title ("Watch List" )
211+ .title ("Chat Watch List" )
211212 .description (description )
212213 .color (Color .CYAN )
213214 .build ());
@@ -218,8 +219,12 @@ private Mono<Message> handleChatWatch(final ChatInputInteractionEvent event, fin
218219 }
219220 return event .createFollowup ()
220221 .withEmbeds (EmbedCreateSpec .builder ()
221- .title ("All Watches Cleared" )
222- .description ("Removed " + watches .size () + " watches." )
222+ .title ("All Chat Watches Cleared" )
223+ .description ("Removed %d watches.\n " .formatted (watches .size ())
224+ + watches .stream ()
225+ .map (GuildChatWatchConfig ::keyword )
226+ .map ("`%s`" ::formatted )
227+ .reduce ("" , (a , b ) -> a + "\n " + b ))
223228 .color (Color .CYAN )
224229 .build ());
225230 }
@@ -325,11 +330,8 @@ private Mono<Message> handlePlayerWatch(final ChatInputInteractionEvent event, f
325330 return event .createFollowup ()
326331 .withEmbeds (populateIdentity (EmbedCreateSpec .builder (), profile )
327332 .color (Color .SEA_GREEN )
328- .description ("""
329- Watch added!
330-
331- Notifications on watched events will be sent to: %s
332- """ .formatted (channel .getMention ()))
333+ .title ("Player Watch Added" )
334+ .description ("Notifications on watched events for `%s` will be sent to: %s" .formatted (profile .name (), channel .getMention ()))
333335 .thumbnail (profile .getAvatarURL ())
334336 .build ());
335337 } else if (option .getOption ("delete" ).isPresent ()) {
@@ -353,13 +355,14 @@ private Mono<Message> handlePlayerWatch(final ChatInputInteractionEvent event, f
353355 guildPlayerWatchRepository .delete (watch );
354356 return event .createFollowup ()
355357 .withEmbeds (populateIdentity (EmbedCreateSpec .builder (), profile )
358+ .title ("Player Watch Deleted" )
356359 .color (Color .SEA_GREEN )
357- .description ("Watch deleted!" )
360+ .description ("Player watch for `%s` deleted!" . formatted ( profile . name ()) )
358361 .thumbnail (profile .getAvatarURL ())
359362 .build ());
360363 }
361364 }
362- return error (event , "No watch found for " + profile .name () + " (" + profile .uuid () + ")" );
365+ return error (event , "No player watch found for `%s` (%s)" . formatted ( profile .name (), profile .uuid ()) );
363366 } else if (option .getOption ("list" ).isPresent ()) {
364367 var watches = guildPlayerWatchRepository .getByGuildId (event .getInteraction ().getGuildId ().get ().asString ());
365368 Collections .sort (watches , (a , b ) -> {
@@ -410,7 +413,7 @@ private Mono<Message> handlePlayerWatch(final ChatInputInteractionEvent event, f
410413 }
411414 return event .createFollowup ()
412415 .withEmbeds (EmbedCreateSpec .builder ()
413- .title ("Watch List" )
416+ .title ("Player Watch List" )
414417 .description (description )
415418 .color (Color .CYAN )
416419 .build ());
@@ -421,8 +424,11 @@ private Mono<Message> handlePlayerWatch(final ChatInputInteractionEvent event, f
421424 }
422425 return event .createFollowup ()
423426 .withEmbeds (EmbedCreateSpec .builder ()
424- .title ("All Watches Cleared" )
425- .description ("Removed " + watches .size () + " watches." )
427+ .title ("All Player Watches Cleared" )
428+ .description ("Removed %d watches.\n " .formatted (watches .size ())
429+ + watches .stream ()
430+ .map (GuildPlayerWatchConfig ::targetName )
431+ .reduce ("" , (a , b ) -> a + "\n " + b ))
426432 .color (Color .CYAN )
427433 .build ());
428434 }
@@ -442,7 +448,7 @@ private ChatInteractionOptionContext resolveProfileSubOption(final ChatInteracti
442448 }
443449 Optional <ProfileData > playerIdentity = playerLookup .getPlayerIdentity (playerName );
444450 if (playerIdentity .isEmpty ()) {
445- ctx .setError ("No player named `" + playerName + " ` exists" );
451+ ctx .setError ("No player named `%s ` exists" . formatted ( playerName ) );
446452 return ctx ;
447453 }
448454 ctx .profileData = playerIdentity .get ();
0 commit comments