File tree Expand file tree Collapse file tree
application/src/main/java/org/togetherjava/tjbot/features/leaderboard Expand file tree Collapse file tree Original file line number Diff line number Diff line change 2121import java .util .Comparator ;
2222import java .util .List ;
2323import java .util .Map ;
24+ import java .util .Objects ;
2425import java .util .StringJoiner ;
2526import java .util .concurrent .CompletableFuture ;
2627import java .util .concurrent .ConcurrentHashMap ;
@@ -54,13 +55,7 @@ public LeaderboardCommand(Config config) {
5455
5556 @ Override
5657 public void onSlashCommand (SlashCommandInteractionEvent event ) {
57- Guild guild = event .getGuild ();
58- if (guild == null ) {
59- event .reply ("This command can only be used inside a server." )
60- .setEphemeral (true )
61- .queue ();
62- return ;
63- }
58+ Guild guild = Objects .requireNonNull (event .getGuild ());
6459
6560 event .deferReply ().queue ();
6661
@@ -73,7 +68,10 @@ public void onSlashCommand(SlashCommandInteractionEvent event) {
7368 .orElse (null );
7469
7570 if (hallOfFame == null ) {
76- event .getHook ().editOriginal ("Could not find the hall of fame channel." ).queue ();
71+ event .getHook ()
72+ .editOriginal (
73+ "Could not find channel matching '%s'." .formatted (channelPattern .pattern ()))
74+ .queue ();
7775 return ;
7876 }
7977
You can’t perform that action at this time.
0 commit comments