aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/commands/play.ts2
-rw-r--r--src/commands/seek.ts14
2 files changed, 12 insertions, 4 deletions
diff --git a/src/commands/play.ts b/src/commands/play.ts
index e6d6464..b155eae 100644
--- a/src/commands/play.ts
+++ b/src/commands/play.ts
@@ -65,7 +65,7 @@ export default class implements Command {
await this.playerManager.get(msg.guild!.id).connect(targetVoiceChannel);
await this.playerManager.get(msg.guild!.id).play();
- await res.stop('play resuming');
+ await res.stop('the stop-and-go light is now green');
return;
}
diff --git a/src/commands/seek.ts b/src/commands/seek.ts
index e2f1154..b3d8002 100644
--- a/src/commands/seek.ts
+++ b/src/commands/seek.ts
@@ -11,8 +11,9 @@ import Command from '.';
export default class implements Command {
public name = 'seek';
public examples = [
- ['seek 10', 'seeks to 10 seconds from begining of song'],
- ['seek 1:30', 'seeks to 1 minute and 30 seconds from begining of song']
+ ['seek 10', 'seeks to 10 seconds from beginning of song'],
+ ['seek 1:30', 'seeks to 1 minute and 30 seconds from beginning of song'],
+ ['seek 1:00:00', 'seeks to 1 hour from beginning of song']
];
private readonly playerManager: PlayerManager;
@@ -43,7 +44,14 @@ export default class implements Command {
let seekTime = 0;
if (time.includes(':')) {
- seekTime = (parseInt(time.split(':')[0], 10) * 60) + parseInt(time.split(':')[1], 10);
+ 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;
+ }
} else {
seekTime = parseInt(time, 10);
}