Enforce file size limit before downloading
This commit is contained in:
parent
a5cc9c45ed
commit
64c45f87c0
1 changed files with 7 additions and 0 deletions
|
@ -63,6 +63,13 @@ export default {
|
||||||
return interaction.editReply({ content: '❌ This does not look like a valid url!', ephemeral: true });
|
return interaction.editReply({ content: '❌ This does not look like a valid url!', ephemeral: true });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const aproxFileSize = await utils.getVideoSize(url, 'bestvideo[height<=?480]');
|
||||||
|
console.log(aproxFileSize);
|
||||||
|
|
||||||
|
if (aproxFileSize > 4) {
|
||||||
|
return interaction.editReply('The file you are trying to convert is too big! Limit is 4 MB');
|
||||||
|
};
|
||||||
|
|
||||||
utils.downloadVideo(url, interaction.id)
|
utils.downloadVideo(url, interaction.id)
|
||||||
.then(async () => {
|
.then(async () => {
|
||||||
const file = fs.readdirSync(os.tmpdir()).filter(fn => fn.startsWith(interaction.id));
|
const file = fs.readdirSync(os.tmpdir()).filter(fn => fn.startsWith(interaction.id));
|
||||||
|
|
Loading…
Reference in a new issue