From 7423e61c84f048ee41aa71b4e336f82fcd257470 Mon Sep 17 00:00:00 2001 From: unknown Date: Sat, 11 May 2024 19:20:18 -0400 Subject: [PATCH] stop double posting --- .../jmusicbot/commands/music/SeekCmd.java | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/jagrosh/jmusicbot/commands/music/SeekCmd.java b/src/main/java/com/jagrosh/jmusicbot/commands/music/SeekCmd.java index bac7d268c..b882b6e29 100644 --- a/src/main/java/com/jagrosh/jmusicbot/commands/music/SeekCmd.java +++ b/src/main/java/com/jagrosh/jmusicbot/commands/music/SeekCmd.java @@ -74,19 +74,18 @@ public void doCommand(CommandEvent event) if (seekMilliseconds > trackDuration) { event.replyError("Cannot seek to `" + TimeUtil.formatTime(seekMilliseconds) + "` because the current track is `" + TimeUtil.formatTime(trackDuration) + "` long!"); + return; + } + + try + { + playingTrack.setPosition(seekMilliseconds); } - else + catch (Exception e) { - try - { - playingTrack.setPosition(seekMilliseconds); - } - catch (Exception e) - { - event.replyError("An error occurred while trying to seek!"); - e.printStackTrace(); - return; - } + event.replyError("An error occurred while trying to seek!"); + e.printStackTrace(); // TODO: remove this + return; } event.replySuccess("Successfully seeked to `" + TimeUtil.formatTime(playingTrack.getPosition()) + "/" + TimeUtil.formatTime(playingTrack.getDuration()) + "`!"); }