File tree Expand file tree Collapse file tree 2 files changed +6
-1
lines changed
src/main/java/net/javadiscord/javabot Expand file tree Collapse file tree 2 files changed +6
-1
lines changed Original file line number Diff line number Diff line change 22
33import com .dynxsty .dih4jda .interactions .commands .SlashCommand ;
44import net .dv8tion .jda .api .entities .User ;
5+ import net .dv8tion .jda .api .entities .channel .ChannelType ;
56import net .dv8tion .jda .api .entities .channel .concrete .TextChannel ;
67import net .dv8tion .jda .api .events .interaction .command .SlashCommandInteractionEvent ;
78import net .dv8tion .jda .api .interactions .commands .OptionMapping ;
@@ -30,6 +31,10 @@ public UnreserveCommand() {
3031
3132 @ Override
3233 public void execute (@ NotNull SlashCommandInteractionEvent event ) {
34+ if (event .getChannelType () != ChannelType .TEXT ) {
35+ Responses .error (event , "This command cannot be used outside of help channels." ).queue ();
36+ return ;
37+ }
3338 TextChannel channel = event .getChannel ().asTextChannel ();
3439 HelpConfig config = Bot .getConfig ().get (event .getGuild ()).getHelpConfig ();
3540 HelpChannelManager channelManager = new HelpChannelManager (config );
Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ private MessageActionUtils() {
3131 * @param components The {@link List} of {@link ItemComponent}s.
3232 * @return A {@link List} of {@link ActionRow}s.
3333 */
34- public static List <ActionRow > toActionRows (List <? extends ItemComponent > components ) {
34+ public static @ NotNull List <ActionRow > toActionRows (@ NotNull List <? extends ItemComponent > components ) {
3535 if (components .size () > 25 ) {
3636 throw new IllegalArgumentException ("Cannot add more than 25 components to a message action." );
3737 }
You can’t perform that action at this time.
0 commit comments