From 931f29bf331ac3061ae8d0f1b616c090aded3af3 Mon Sep 17 00:00:00 2001 From: onebeastchris Date: Wed, 1 Nov 2023 19:23:51 +0100 Subject: [PATCH] add min/max value & max length check to port remove timestamp, changed title --- .../java/org/geysermc/discordbot/commands/PingCommand.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/main/java/org/geysermc/discordbot/commands/PingCommand.java b/src/main/java/org/geysermc/discordbot/commands/PingCommand.java index 2be0898e..9de3528c 100644 --- a/src/main/java/org/geysermc/discordbot/commands/PingCommand.java +++ b/src/main/java/org/geysermc/discordbot/commands/PingCommand.java @@ -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) ); } @@ -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(); }