fixed the filter
This commit is contained in:
parent
4c3e1a5125
commit
20115c7bd6
1 changed files with 5 additions and 3 deletions
|
@ -32,15 +32,17 @@ class musicCommand extends Command {
|
||||||
let link;
|
let link;
|
||||||
let Attachment = (message.attachments).array();
|
let Attachment = (message.attachments).array();
|
||||||
|
|
||||||
|
function checkURL(url) {
|
||||||
|
return(url.match(/\.(mp3|wav|mp4|webm)$/) != null);
|
||||||
|
}
|
||||||
|
|
||||||
if (!args.music && Attachment[0]) {
|
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');
|
return message.channel.send('Only mp3,wav,mp4 and webm are supported');
|
||||||
link = Attachment[0].url;
|
link = Attachment[0].url;
|
||||||
} else {
|
} else {
|
||||||
link = args.music;
|
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');
|
return message.channel.send('Only mp3,wav,mp4 and webm are supported');
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue