This commit is contained in:
Flummi
2020-10-15 13:02:56 +02:00
parent a01f19c644
commit b8ed192ea5
3 changed files with 44 additions and 21 deletions

View File

@@ -1,6 +1,7 @@
import cfg from "../../../config.json";
import sql from "../sql.mjs";
import lib from "../lib.mjs";
import { getLevel } from "../admin.mjs";
import fs from "fs";
import { exec as _exec } from "child_process";
@@ -50,7 +51,8 @@ export default async bot => {
// download data
const start = new Date();
const source = (await exec(`youtube-dl "${link}" --max-filesize 10000m -o ./tmp/${filename}`)).stdout.trim();
const maxfilesize = getLevel(e.user).level > 50 ? cfg.main.maxfilesize * 2.5 : cfg.main.maxfilesize;
const source = (await exec(`youtube-dl "${link}" --max-filesize ${maxfilesize} -o ./tmp/${filename}`)).stdout.trim();
if(source.match(/larger than/))
return e.reply("too large lol");
const end = ~~((new Date() - start) / 1e3);