Skip to content

Commit

Permalink
stop double posting
Browse files Browse the repository at this point in the history
  • Loading branch information
jagrosh committed May 11, 2024
1 parent f5e1d21 commit 7423e61
Showing 1 changed file with 10 additions and 11 deletions.
21 changes: 10 additions & 11 deletions src/main/java/com/jagrosh/jmusicbot/commands/music/SeekCmd.java
Original file line number Diff line number Diff line change
Expand Up @@ -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()) + "`!");
}
Expand Down

0 comments on commit 7423e61

Please sign in to comment.