Skip to content

Commit 0a28765

Browse files
Prevent /slowmode in threads
1 parent 9f62f37 commit 0a28765

1 file changed

Lines changed: 8 additions & 0 deletions

File tree

src/main/java/technobot/commands/staff/SlowmodeCommand.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package technobot.commands.staff;
22

33
import net.dv8tion.jda.api.Permission;
4+
import net.dv8tion.jda.api.entities.ChannelType;
45
import net.dv8tion.jda.api.entities.Role;
56
import net.dv8tion.jda.api.entities.TextChannel;
67
import net.dv8tion.jda.api.events.interaction.command.SlashCommandInteractionEvent;
@@ -41,6 +42,13 @@ public void execute(SlashCommandInteractionEvent event) {
4142
return;
4243
}
4344

45+
// Prevent slowmode in threads
46+
ChannelType type = event.getChannelType();
47+
if (type == ChannelType.GUILD_PUBLIC_THREAD || type == ChannelType.GUILD_NEWS_THREAD || type == ChannelType.GUILD_PRIVATE_THREAD) {
48+
event.replyEmbeds(EmbedUtils.createError("You cannot set slowmode on threads!")).queue();
49+
return;
50+
}
51+
4452
OptionMapping timeOption = event.getOption("time");
4553
if (timeOption != null) {
4654
// Retrieve time in seconds from input

0 commit comments

Comments
 (0)