aboutsummaryrefslogtreecommitdiff
path: root/src/commands
diff options
context:
space:
mode:
authorMax Isom <[email protected]>2020-03-20 20:51:33 -0500
committerMax Isom <[email protected]>2020-03-20 20:51:33 -0500
commit95ea8e9ad3c81d29cc38977867179b4a61c5eee5 (patch)
tree6731854f398acc48ac57a60faf67c0f2b82221dc /src/commands
parent9c91ce1a13cad701bc8876fd07ac4d513522a215 (diff)
downloadmuse-95ea8e9ad3c81d29cc38977867179b4a61c5eee5.tar.xz
muse-95ea8e9ad3c81d29cc38977867179b4a61c5eee5.zip
Remove redundent code
Diffstat (limited to 'src/commands')
-rw-r--r--src/commands/seek.ts10
1 files changed, 2 insertions, 8 deletions
diff --git a/src/commands/seek.ts b/src/commands/seek.ts
index 89e174e..de8f03e 100644
--- a/src/commands/seek.ts
+++ b/src/commands/seek.ts
@@ -5,6 +5,7 @@ import PlayerManager from '../managers/player';
import LoadingMessage from '../utils/loading-message';
import errorMsg from '../utils/error-msg';
import Command from '.';
+import {parseTime} from '../utils/time';
@injectable()
export default class implements Command {
@@ -44,14 +45,7 @@ export default class implements Command {
let seekTime = 0;
if (time.includes(':')) {
- const timeGroups = time.split(':').map(t => parseInt(t, 10));
- let currentTimePeriod = 1;
-
- for (let i = timeGroups.length - 1; i >= 0; i--) {
- seekTime += currentTimePeriod * timeGroups[i];
-
- currentTimePeriod *= 60;
- }
+ seekTime = parseTime(time);
} else {
seekTime = parseInt(time, 10);
}