File tree Expand file tree Collapse file tree
src/main/java/technobot/commands/suggestions Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -66,10 +66,16 @@ public void execute(SlashCommandInteractionEvent event) {
6666 text = EmbedUtils .BLUE_TICK + " Created a new suggestion channel!" ;
6767 } else {
6868 // Set suggestion board to mentioned channel
69- long channel = channelOption .getAsGuildChannel ().getIdLong ();
70- String channelMention = "<#" + channel + ">" ;
71- suggestionHandler .setChannel (channel );
72- text = EmbedUtils .BLUE_TICK + " Set the suggestion channel to " + channelMention ;
69+ try {
70+ long channel = channelOption .getAsTextChannel ().getIdLong ();
71+ String channelMention = "<#" + channel + ">" ;
72+ suggestionHandler .setChannel (channel );
73+ text = EmbedUtils .BLUE_TICK + " Set the suggestion channel to " + channelMention ;
74+ } catch (NullPointerException e ) {
75+ text = "You can only set a text channel as the suggestion board!" ;
76+ event .getHook ().sendMessageEmbeds (EmbedUtils .createError (text )).queue ();
77+ return ;
78+ }
7379 }
7480 }
7581 case "dm" -> {
You can’t perform that action at this time.
0 commit comments