Skip to content

Commit d07e259

Browse files
Fixed /format-code allowing String inputs
1 parent b06cdc2 commit d07e259

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/main/java/net/javadiscord/javabot/systems/user_commands/format_code/FormatCodeCommand.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import net.dv8tion.jda.api.interactions.commands.build.OptionData;
1010
import net.dv8tion.jda.api.interactions.components.ActionRow;
1111
import net.dv8tion.jda.api.interactions.components.buttons.Button;
12+
import net.javadiscord.javabot.util.Checks;
1213
import net.javadiscord.javabot.util.InteractionUtils;
1314
import net.javadiscord.javabot.util.Responses;
1415
import net.javadiscord.javabot.util.StringUtils;
@@ -82,6 +83,10 @@ public void execute(@NotNull SlashCommandInteractionEvent event) {
8283
}
8384
});
8485
} else {
86+
if (Checks.isInvalidLongInput(idOption)) {
87+
Responses.error(event, "Please provide a valid message id!").queue();
88+
return;
89+
}
8590
long messageId = idOption.getAsLong();
8691
event.getChannel().retrieveMessageById(messageId).queue(
8792
target -> event.getHook().sendMessageFormat("```%s\n%s\n```", format, StringUtils.standardSanitizer().compute(target.getContentRaw()))

0 commit comments

Comments
 (0)