diff --git a/commands/download.js b/commands/download.js index 3200aa1..9e77309 100644 --- a/commands/download.js +++ b/commands/download.js @@ -21,6 +21,11 @@ module.exports = { await interaction.deferReply({ ephemeral: false }); 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')) { let qualitys = await new Promise((resolve, reject) => { exec(`./bin/yt-dlp ${url} --print "%()j"`, (err, stdout, stderr) => {