Add method to check if is soundcloud link

This commit is contained in:
Androz2091 2020-08-14 14:47:49 +02:00
parent 8911bc46f1
commit 21bcb33caa
2 changed files with 6 additions and 0 deletions

View file

@ -32,6 +32,7 @@
"merge-options": "^2.0.0",
"moment": "^2.27.0",
"node-fetch": "^2.6.0",
"soundcloud-scraper": "^1.0.1",
"spotify-url-info": "^1.3.1",
"ytpl": "^0.2.4",
"ytsr": "^0.1.19"

View file

@ -1,4 +1,5 @@
const ytpl = require('ytpl')
const scraper = require('soundcloud-scraper')
const Discord = require('discord.js')
const youtubeVideoRegex = (/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/)
@ -13,6 +14,10 @@ module.exports = class Util {
return channel.members.filter((member) => !member.user.bot).size === 0
}
static isSoundcloudLink (query) {
return scraper.validateURL(query)
}
static isSpotifyLink (query) {
return spotifySongRegex.test(query)
}