1
0
mirror of https://github.com/musix-org/musix-oss synced 2025-08-02 06:14:35 +00:00

More powerful number handling. Setting whether to announce songs starting to play. Remove command fixes

This commit is contained in:
MatteZ02
2019-10-24 20:11:08 +03:00
parent bd9ef87dde
commit 38c0103281
10 changed files with 75 additions and 35 deletions

View File

@@ -19,12 +19,12 @@ module.exports = {
}
}
if (!args[1]) return message.channel.send(`:x: Correct usage: \`${prefix}seek <seeking point in seconds>\``);
if (isNaN(args[1])) return message.channel.send(':x: I\'m sorry, But you need to enter a valid __number__.');
const argsNumber = parseInt(args[1]);
if (argsNumber < 0) return message.channel.send(':x: The seeking point needs to be a positive number!');
if (argsNumber > data.length_seconds) return message.channel.send(`:x: The lenght of this song is ${data.length_seconds} seconds! You can't seek further than that!`);
const pos = parseInt(args[1])
if (isNaN(pos)) return message.channel.send(':x: I\'m sorry, But you need to enter a valid __number__.');
if (pos < 0) return message.channel.send(':x: The seeking point needs to be a positive number!');
if (pos > data.length_seconds) return message.channel.send(`:x: The lenght of this song is ${data.length_seconds} seconds! You can't seek further than that!`);
serverQueue.connection.dispatcher.end('seek');
client.funcs.play(message.guild, serverQueue.songs[0], client, message, args[1]);
client.funcs.play(message.guild, serverQueue.songs[0], client, message, pos, false);
} else {
message.channel.send(':x: There is nothing playing!');
}