🎨 Clean up code (#227)

Tidied up the code a bit
This commit is contained in:
Guizz 2021-01-03 08:01:24 -03:00 committed by GitHub
parent d443652c8c
commit a82bc52491
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,8 +1,6 @@
const ytsr = require('youtube-sr')
const soundcloud = require('soundcloud-scraper')
const Discord = require('discord.js')
const youtubeVideoRegex = (/(?:youtube\.com\/(?:[^/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?/\s]{11})/)
const spotifySongRegex = (/https?:\/\/(?:embed\.|open\.)(?:spotify\.com\/)(?:track\/|\?uri=spotify:track:)((\w|-){22})/)
module.exports = class Util {
@ -23,10 +21,10 @@ module.exports = class Util {
}
static isYTPlaylistLink (query) {
return ytsr.default.validate(query, 'PLAYLIST')
return ytsr.validate(query, 'PLAYLIST')
}
static isYTVideoLink (query) {
return youtubeVideoRegex.test(query)
return ytsr.validate(query, 'VIDEO')
}
}