Skip to content

Commit f4f4171

Browse files
committed
allow using /embed create in threads
1 parent d9af1e9 commit f4f4171

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/main/java/net/javadiscord/javabot/systems/staff_commands/embeds/CreateEmbedSubcommand.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import net.dv8tion.jda.api.entities.*;
99
import net.dv8tion.jda.api.entities.channel.Channel;
1010
import net.dv8tion.jda.api.entities.channel.ChannelType;
11-
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
1211
import net.dv8tion.jda.api.entities.channel.middleman.GuildMessageChannel;
12+
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
1313
import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent;
1414
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
1515
import net.dv8tion.jda.api.interactions.commands.OptionType;
@@ -78,7 +78,11 @@ public void handleModal(@NotNull ModalInteractionEvent event, @NotNull List<Moda
7878
return;
7979
}
8080
String[] id = ComponentIdBuilder.split(event.getModalId());
81-
TextChannel channel = event.getGuild().getTextChannelById(id[1]);
81+
String channelId = id[1];
82+
MessageChannel channel = event.getGuild().getTextChannelById(channelId);
83+
if (channel == null) {
84+
channel = event.getGuild().getThreadChannelById(channelId);
85+
}
8286
if (channel == null) {
8387
Responses.error(event.getHook(), "Please provide a valid text channel.").queue();
8488
return;

0 commit comments

Comments
 (0)