This commit is contained in:
Flummi
2020-04-09 18:44:09 +02:00
parent 46082780e1
commit 97096357e5
17 changed files with 39 additions and 8829 deletions

View File

@ -35,7 +35,7 @@ export default async bot => {
e.reply(`${tmp.length}, ${rows.length}, ${dir.length}`);
break;
default:
return e.reply("lul");
return;
}
}
}]

View File

@ -1,5 +1,6 @@
import cfg from "../../../config.json";
import sql from "../sql.mjs";
import lib from "../lib.mjs";
import fs from "fs";
import { exec as _exec } from "child_process";
@ -8,6 +9,10 @@ const exec = promisify(_exec);
const regex = /https?:\/\/[\w\S(\.|:|/)]+/gi;
console.log(
lib.calcSpeed(123456, 56432)
);
export default async bot => {
return [{
@ -40,9 +45,11 @@ export default async bot => {
const filename = `${uuid}.${meta.ext}`;
// download data
const source = (await exec(`youtube-dl "${link}" --max-filesize 100m -o ./tmp/${filename}`)).stdout.trim();
const start = new Date();
const source = (await exec(`youtube-dl "${link}" --max-filesize 10000m -o ./tmp/${filename}`)).stdout.trim();
if(source.match(/larger than/))
return e.reply("too large lol");
const end = ~~((new Date() - start) / 1e3);
// generate checksum
const checksum = (await exec(`sha256sum ./tmp/${filename}`)).stdout.trim().split(" ")[0];
@ -81,8 +88,8 @@ export default async bot => {
e.reply([
`title: ${meta.fulltitle}`,
`name: ${filename}`,
`size: ${size}`,
`size: ${lib.formatSize(size)}`,
`speed: ${lib.calcSpeed(size, end)}`,
`link: ${cfg.main.url}/${insertq.insertId}`
]);