This commit is contained in:
Flummi
2018-09-09 17:42:59 +02:00
parent 9d440644bc
commit 0d39f68990
5 changed files with 47 additions and 359 deletions

View File

@ -15,6 +15,8 @@ export default bot => {
active: true,
f: e => {
const args = e.message.trim().substring(7);
if(args === "true" || args === "false")
return e.self.debug = !e.self.debug;
try {
context.admins = admins;
context.e = e;

View File

@ -3,15 +3,16 @@ import sql from "../sql";
import * as lib from "./inc/parser";
import fs from "fs";
import fetch from "node-fetch";
//import fetch from "node-fetch";
import fetch from "../fetch";
import { promisify } from "util";
import { execFile as ef } from "child_process";
const execFile = promisify(ef);
const bin = process.cwd() + "/bin/youtube-dl";
const b = process.cwd() + "/b";
const _args = [ "--dump-json" ];
const regex = /https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi;
const execFile = promisify(ef)
, bin = process.cwd() + "/bin/youtube-dl"
, b = process.cwd() + "/b"
, _args = [ "--dump-json" ]
, regex = /https?:\/\/[\w-]+(\.[\w-]+)+\.?(:\d+)?(\/\S*)?/gi;
export default bot => {
bot._trigger.set("parser", new bot.trigger({
@ -69,6 +70,8 @@ export default bot => {
return e.reply("no filters found, f0ck! D:");
fetch(data.format[0].url, { size: cfg.main.maxFileSize.val })
.then(res => {
if(res.headers["content-length"] >= cfg.main.maxFileSize.val)
return e.reply(`file too large soos! D; (~${lib.formatSize(res.headers["content-length"])} / ~${lib.formatSize(cfg.main.maxFileSize.val)})`);
const uuid = lib.getUUID();
const file = `${b}/${uuid}.${data.format[0].ext}`;
const dest = fs.createWriteStream(file);