fixed the filter

This commit is contained in:
loicbersier 2019-01-16 00:46:24 +01:00
parent 4c3e1a5125
commit 20115c7bd6

View file

@ -32,15 +32,17 @@ class musicCommand extends Command {
let link;
let Attachment = (message.attachments).array();
function checkURL(url) {
return(url.match(/\.(mp3|wav|mp4|webm)$/) != null);
}
if (!args.music && Attachment[0]) {
if (!Attachment[0].url.endsWith('mp3' || 'wav' || 'mp4' || 'webm'))
if (!checkURL(Attachment[0].url))
return message.channel.send('Only mp3,wav,mp4 and webm are supported');
link = Attachment[0].url;
} else {
link = args.music;
if (!link.endsWith('mp3' || 'wav' || 'mp4' || 'webm'))
if (!checkURL(link))
return message.channel.send('Only mp3,wav,mp4 and webm are supported');
}