muh
This commit is contained in:
parent
312d3f0769
commit
b7abae5f5e
|
@ -19,65 +19,70 @@ module.exports = (bot, trigger, lib) => {
|
||||||
lib.checkRepost(entry, (cbcr) => {
|
lib.checkRepost(entry, (cbcr) => {
|
||||||
if(cbcr) {
|
if(cbcr) {
|
||||||
ytdl.getInfo(entry, (err, info) => {
|
ytdl.getInfo(entry, (err, info) => {
|
||||||
var title = info.title;
|
if(!err) {
|
||||||
var dat = fs.createWriteStream('./b/'+tmpdest+'.webm');
|
var title = info.title;
|
||||||
|
var dat = fs.createWriteStream('./b/'+tmpdest+'.webm');
|
||||||
try {
|
|
||||||
ytdl.downloadFromInfo(info, { filter: (format) => { return format.container === 'webm'; } })
|
try {
|
||||||
.on('response', (res) => {
|
ytdl.downloadFromInfo(info, { filter: (format) => { return format.container === 'webm'; } })
|
||||||
if(res.headers['content-length'] > lib.cfg.maxFileSize) {
|
.on('response', (res) => {
|
||||||
res.destroy();
|
if(res.headers['content-length'] > lib.cfg.maxFileSize) {
|
||||||
dl = false;
|
res.destroy();
|
||||||
e.reply('f0ck! your file is too big (~'+lib.formatSize(res.headers['content-length'])+'), max '+lib.formatSize(lib.cfg.maxFileSize)+' allowed');
|
dl = false;
|
||||||
}
|
e.reply('f0ck! your file is too big (~'+lib.formatSize(res.headers['content-length'])+'), max '+lib.formatSize(lib.cfg.maxFileSize)+' allowed');
|
||||||
})
|
}
|
||||||
.on('error', (err) => {
|
})
|
||||||
//e.reply(err);
|
.on('error', (err) => {
|
||||||
})
|
//e.reply(err);
|
||||||
.pipe( dat );
|
})
|
||||||
}
|
.pipe( dat );
|
||||||
catch(ex) {
|
}
|
||||||
e.reply(ex);
|
catch(ex) {
|
||||||
}
|
e.reply(ex);
|
||||||
|
}
|
||||||
dat.on('finish', () => {
|
|
||||||
if(dl) {
|
dat.on('finish', () => {
|
||||||
dat.close();
|
if(dl) {
|
||||||
var stat = fs.statSync("./b/"+tmpdest+".webm");
|
dat.close();
|
||||||
lib.getUser(e, (cbgu) => {
|
var stat = fs.statSync("./b/"+tmpdest+".webm");
|
||||||
lib.getCheckSum("./b/"+tmpdest+".webm", (cbcs) => {
|
lib.getUser(e, (cbgu) => {
|
||||||
lib.checkRepostCheckSum(cbcs, (cbcrcs) => {
|
lib.getCheckSum("./b/"+tmpdest+".webm", (cbcs) => {
|
||||||
if(cbcrcs) {
|
lib.checkRepostCheckSum(cbcs, (cbcrcs) => {
|
||||||
lib.sql.query("insert into `f0ck`.`items` (`src`,`dest`,`mime`,`size`,`checksum`,`username`,`userchannel`,`usernetwork`,`stamp`,`active`) values (?,?,?,?,?,?,?,?,?,?)", [
|
if(cbcrcs) {
|
||||||
entry,
|
lib.sql.query("insert into `f0ck`.`items` (`src`,`dest`,`mime`,`size`,`checksum`,`username`,`userchannel`,`usernetwork`,`stamp`,`active`) values (?,?,?,?,?,?,?,?,?,?)", [
|
||||||
"./b/"+tmpdest+".webm",
|
entry,
|
||||||
"video/webm",
|
"./b/"+tmpdest+".webm",
|
||||||
stat.size,
|
"video/webm",
|
||||||
cbcs,
|
stat.size,
|
||||||
cbgu['nick'],
|
cbcs,
|
||||||
e.channel.getName(),
|
cbgu['nick'],
|
||||||
e.network,
|
e.channel.getName(),
|
||||||
Math.floor(new Date() / 1000),
|
e.network,
|
||||||
0
|
Math.floor(new Date() / 1000),
|
||||||
]).on('result', (result) => {
|
0
|
||||||
lib.generateThumbs();
|
]).on('result', (result) => {
|
||||||
e.reply("https://f0ck.me/"+result.insertId+" - "+title+" (video/webm, ~"+lib.formatSize(stat.size)+") from "+cbgu['nick']+" ("+cbgu['username']+"@"+cbgu['hostname']+")");
|
lib.generateThumbs();
|
||||||
}).on('error', (msg) => {
|
e.reply("https://f0ck.me/"+result.insertId+" - "+title+" (video/webm, ~"+lib.formatSize(stat.size)+") from "+cbgu['nick']+" ("+cbgu['username']+"@"+cbgu['hostname']+")");
|
||||||
e.reply(msg);
|
}).on('error', (msg) => {
|
||||||
});
|
e.reply(msg);
|
||||||
}
|
});
|
||||||
else {
|
}
|
||||||
fs.unlink("./b/"+tmpdest+".webm"); // delete repost
|
else {
|
||||||
e.reply("repost motherf0cker");
|
fs.unlink("./b/"+tmpdest+".webm"); // delete repost
|
||||||
}
|
e.reply("repost motherf0cker");
|
||||||
|
}
|
||||||
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
}
|
else
|
||||||
else
|
fs.unlink('./b/'+tmpdest+'.webm');
|
||||||
fs.unlink('./b/'+tmpdest+'.webm');
|
});
|
||||||
});
|
});
|
||||||
});
|
}
|
||||||
|
else {
|
||||||
|
e.reply("f0ck GEMA");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
e.reply('repost motherf0cker');
|
e.reply('repost motherf0cker');
|
||||||
|
|
Loading…
Reference in New Issue
Block a user