Skip to content

Commit

Permalink
add min/max value & max length check to port
Browse files Browse the repository at this point in the history
remove timestamp, changed title
  • Loading branch information
onebeastchris committed Nov 1, 2023
1 parent 4fa4f63 commit 931f29b
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@ public PingCommand() {
this.options = List.of(
new OptionData(OptionType.STRING, "ip", "The IP Address of the server you want to ping", true),
new OptionData(OptionType.INTEGER, "port", "The port of the server you want to ping", false)
.setMinValue(1)
.setMaxValue(65535)
.setMaxLength(5)
);
}

Expand Down Expand Up @@ -169,10 +172,9 @@ private MessageEmbed handle(String ip, Integer port) {
}

return new EmbedBuilder()
.setTitle("Pinging server: " + ip + (port != null ? " with the port " + port : ""))
.setTitle("Pinging server " + ip + (port != null ? " - " + port : ""))
.addField("Java", javaInfo, false)
.addField("Bedrock", bedrockInfo, false)
.setTimestamp(Instant.now())
.setColor(success ? BotColors.SUCCESS.getColor() : BotColors.FAILURE.getColor())
.build();
}
Expand Down

0 comments on commit 931f29b

Please sign in to comment.