Skip to content

Commit 8e4a8ef

Browse files
authored
Update seek.js (#1147)
* Update seek.js allows for better formatting. allows users to put in something like 3h 30m instead of 210m * Update seek.js Fix; error message grammar
1 parent d575b1b commit 8e4a8ef

File tree

1 file changed

+10
-5
lines changed

1 file changed

+10
-5
lines changed

commands/slash/seek.js

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ const command = new SlashCommand()
88
.addStringOption((option) =>
99
option
1010
.setName("time")
11-
.setDescription("Seek to time you want. Ex 2m | 10s | 53s")
11+
.setDescription("Seek to time you want. Ex 1h 30m | 2h | 80m | 53s")
1212
.setRequired(true),
1313
)
1414
.setRun(async (client, interaction, options) => {
@@ -42,9 +42,14 @@ const command = new SlashCommand()
4242
}
4343

4444
await interaction.deferReply();
45-
46-
const args = interaction.options.getString("time");
47-
const time = ms(args);
45+
46+
const rawArgs = interaction.options.getString("time");
47+
const args = rawArgs.split(' ');
48+
var rawTime = [];
49+
for (i = 0; i < args.length; i++){
50+
rawTime.push(ms(args[i]));
51+
}
52+
const time = rawTime.reduce((a,b) => a + b, 0);
4853
const position = player.position;
4954
const duration = player.queue.current.duration;
5055

@@ -67,7 +72,7 @@ const command = new SlashCommand()
6772
new MessageEmbed()
6873
.setColor(client.config.embedColor)
6974
.setDescription(
70-
`Cannot seek current playing track. This may happened because seek duration has exceeded track duration`,
75+
`Unable to seek current playing track. This may be due to exceeding track duration or an incorrect time format. Please check and try again`,
7176
),
7277
],
7378
});

0 commit comments

Comments
 (0)