From 20115c7bd6785c41edce2298ddd70dc1add80059 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Wed, 16 Jan 2019 00:46:24 +0100 Subject: [PATCH] fixed the filter --- commands/utility/musicMatch.js | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/commands/utility/musicMatch.js b/commands/utility/musicMatch.js index 6659f78..6f86fe1 100644 --- a/commands/utility/musicMatch.js +++ b/commands/utility/musicMatch.js @@ -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'); }