@@ -74,19 +74,31 @@ public void execute(SlashCommandInteractionEvent event) {
7474 }
7575 case "blacklist" -> {
7676 if (channelOption != null ) {
77- long channel = channelOption .getAsTextChannel ().getIdLong ();
78- starboardHandler .blacklistChannel (channel );
79- text = EmbedUtils .BLUE_TICK + " Starboard will now ignore reactions from <#" + channel + ">" ;
77+ try {
78+ long channel = channelOption .getAsTextChannel ().getIdLong ();
79+ starboardHandler .blacklistChannel (channel );
80+ text = EmbedUtils .BLUE_TICK + " Starboard will now ignore reactions from <#" + channel + ">" ;
81+ } catch (NullPointerException e ) {
82+ text = "You can only blacklist a text channel!" ;
83+ event .getHook ().sendMessageEmbeds (EmbedUtils .createError (text )).queue ();
84+ return ;
85+ }
8086 } else {
8187 starboardHandler .clearBlacklist ();
8288 text = EmbedUtils .BLUE_TICK + " Reset the starboard blacklist!" ;
8389 }
8490 }
8591 case "unblacklist" -> {
8692 if (channelOption != null ) {
87- long channel = channelOption .getAsTextChannel ().getIdLong ();
88- starboardHandler .unBlacklistChannel (channel );
89- text = EmbedUtils .BLUE_X + " Removed <#" + channel + "> from the Starboard blacklist!" ;
93+ try {
94+ long channel = channelOption .getAsTextChannel ().getIdLong ();
95+ starboardHandler .unBlacklistChannel (channel );
96+ text = EmbedUtils .BLUE_X + " Removed <#" + channel + "> from the Starboard blacklist!" ;
97+ } catch (NullPointerException e ) {
98+ text = "You can only unblacklist a text channel!" ;
99+ event .getHook ().sendMessageEmbeds (EmbedUtils .createError (text )).queue ();
100+ return ;
101+ }
90102 } else {
91103 starboardHandler .clearBlacklist ();
92104 text = EmbedUtils .BLUE_TICK + " Reset the starboard blacklist!" ;
0 commit comments