✨ Add method to check if is soundcloud link
This commit is contained in:
parent
8911bc46f1
commit
21bcb33caa
2 changed files with 6 additions and 0 deletions
|
@ -32,6 +32,7 @@
|
||||||
"merge-options": "^2.0.0",
|
"merge-options": "^2.0.0",
|
||||||
"moment": "^2.27.0",
|
"moment": "^2.27.0",
|
||||||
"node-fetch": "^2.6.0",
|
"node-fetch": "^2.6.0",
|
||||||
|
"soundcloud-scraper": "^1.0.1",
|
||||||
"spotify-url-info": "^1.3.1",
|
"spotify-url-info": "^1.3.1",
|
||||||
"ytpl": "^0.2.4",
|
"ytpl": "^0.2.4",
|
||||||
"ytsr": "^0.1.19"
|
"ytsr": "^0.1.19"
|
||||||
|
|
|
@ -1,4 +1,5 @@
|
||||||
const ytpl = require('ytpl')
|
const ytpl = require('ytpl')
|
||||||
|
const scraper = require('soundcloud-scraper')
|
||||||
const Discord = require('discord.js')
|
const Discord = require('discord.js')
|
||||||
|
|
||||||
const youtubeVideoRegex = (/(?:youtube\.com\/(?:[^\/]+\/.+\/|(?:v|e(?:mbed)?)\/|.*[?&]v=)|youtu\.be\/)([^"&?\/\s]{11})/)
|
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
|
return channel.members.filter((member) => !member.user.bot).size === 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static isSoundcloudLink (query) {
|
||||||
|
return scraper.validateURL(query)
|
||||||
|
}
|
||||||
|
|
||||||
static isSpotifyLink (query) {
|
static isSpotifyLink (query) {
|
||||||
return spotifySongRegex.test(query)
|
return spotifySongRegex.test(query)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue