File tree Expand file tree Collapse file tree
src/main/java/technobot/commands/starboard Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -51,9 +51,15 @@ public void execute(SlashCommandInteractionEvent event) {
5151 switch (event .getSubcommandName ()) {
5252 case "create" -> {
5353 // Set starboard channel
54- long channel = channelOption .getAsGuildChannel ().getIdLong ();
55- starboardHandler .setChannel (channel );
56- text = EmbedUtils .BLUE_TICK + " Set the starboard channel to <#" + channel + ">" ;
54+ try {
55+ long channel = channelOption .getAsTextChannel ().getIdLong ();
56+ starboardHandler .setChannel (channel );
57+ text = EmbedUtils .BLUE_TICK + " Set the starboard channel to <#" + channel + ">" ;
58+ } catch (NullPointerException e ) {
59+ text = "You can only set a text channel as the starboard!" ;
60+ event .getHook ().sendMessageEmbeds (EmbedUtils .createError (text )).queue ();
61+ return ;
62+ }
5763 }
5864 case "limit" -> {
5965 OptionMapping limitOption = event .getOption ("stars" );
You can’t perform that action at this time.
0 commit comments