Skip to content

Commit f8a31f2

Browse files
Added missing channel-check to /unreserve
1 parent 45404f5 commit f8a31f2

File tree

2 files changed

+6
-1
lines changed

2 files changed

+6
-1
lines changed

src/main/java/net/javadiscord/javabot/systems/help/commands/UnreserveCommand.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
import com.dynxsty.dih4jda.interactions.commands.SlashCommand;
44
import net.dv8tion.jda.api.entities.User;
5+
import net.dv8tion.jda.api.entities.channel.ChannelType;
56
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
67
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
78
import 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);

src/main/java/net/javadiscord/javabot/util/MessageActionUtils.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff 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
}

0 commit comments

Comments
 (0)