From 46f8f2529a0c0e2f06abd5a04efb6904f189d54a Mon Sep 17 00:00:00 2001 From: ChomeNS Date: Fri, 24 Mar 2023 20:06:39 +0700 Subject: [PATCH] goto fix mabe --- .../me/chayapak1/chomens_bot/commands/MusicCommand.java | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/main/java/me/chayapak1/chomens_bot/commands/MusicCommand.java b/src/main/java/me/chayapak1/chomens_bot/commands/MusicCommand.java index c75b701..0600385 100644 --- a/src/main/java/me/chayapak1/chomens_bot/commands/MusicCommand.java +++ b/src/main/java/me/chayapak1/chomens_bot/commands/MusicCommand.java @@ -235,7 +235,13 @@ public class MusicCommand implements Command { public Component goTo (CommandContext context, String[] args) { final Bot bot = context.bot(); final Song currentSong = bot.music().currentSong(); - final long milliseconds = Long.getLong(args[0]); + + final long milliseconds; + try { + milliseconds = Long.parseLong(args[1]); + } catch (NumberFormatException e) { + return Component.text("Invalid timestamp").color(NamedTextColor.RED); + } if (currentSong == null) return Component.text("No song is currently playing").color(NamedTextColor.RED); if (milliseconds < 0 || milliseconds > currentSong.length) return Component.text("Invalid timestamp").color(NamedTextColor.RED);