From 3c97ae3aa55480f1de8fc19d211ab80a1edc5a15 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Mon, 3 Aug 2020 11:07:14 +0200 Subject: [PATCH] 50 MB file limit ( accidentally removed it once ) --- commands/fun/ytp.js | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/commands/fun/ytp.js b/commands/fun/ytp.js index 9408f222..994ea5e0 100644 --- a/commands/fun/ytp.js +++ b/commands/fun/ytp.js @@ -158,6 +158,15 @@ class ytpCommand extends Command { loadingmsg.delete(); return message.reply('This video is a duplicate... Not adding.'); } else { + let file = fs.statSync(output); + let fileSize = file.size / 1000000.0; + + if (fileSize > 50) { + fs.unlinkSync(output); + loadingmsg.delete(); + return message.reply('Video too big.. Not adding.'); + } + const body = {hash: hash, link: args.link, messageID: message.id}; await ytpHash.create(body); }