Check for the url to be a url
This commit is contained in:
parent
14ee901846
commit
53624abff0
1 changed files with 5 additions and 0 deletions
|
@ -21,6 +21,11 @@ module.exports = {
|
||||||
await interaction.deferReply({ ephemeral: false });
|
await interaction.deferReply({ ephemeral: false });
|
||||||
const url = interaction.options.getString('url');
|
const url = interaction.options.getString('url');
|
||||||
|
|
||||||
|
const urlRE = new RegExp('([a-zA-Z0-9]+://)?([a-zA-Z0-9_]+:[a-zA-Z0-9_]+@)?([a-zA-Z0-9.-]+\\.[A-Za-z]{2,4})(:[0-9]+)?([^ ])+');
|
||||||
|
if (!url.match(urlRE)) {
|
||||||
|
return interaction.editReply({ content: '❌ This does not look like a valid URL!', ephemeral: true });
|
||||||
|
}
|
||||||
|
|
||||||
if (interaction.options.getBoolean('advanced')) {
|
if (interaction.options.getBoolean('advanced')) {
|
||||||
let qualitys = await new Promise((resolve, reject) => {
|
let qualitys = await new Promise((resolve, reject) => {
|
||||||
exec(`./bin/yt-dlp ${url} --print "%()j"`, (err, stdout, stderr) => {
|
exec(`./bin/yt-dlp ${url} --print "%()j"`, (err, stdout, stderr) => {
|
||||||
|
|
Loading…
Reference in a new issue