This commit is contained in:
Flummi 2016-08-30 21:18:18 +00:00
parent dbb14b3a5c
commit 69a8706552
3 changed files with 15 additions and 7 deletions

View File

@ -32,7 +32,7 @@
}
});
}
setTimeout(scrollListener, 50);
setTimeout(scrollListener, 200);
});
};
$(document).ready(function () {

View File

@ -5,7 +5,7 @@ var exec = require('child_process').exec;
var probe = require('node-ffprobe');
var crypto = require('crypto');
var Mime = require('mime');
var cfg = require('../cfg/main.json');
var cfg;
var bot, sql, debug;
@ -14,6 +14,7 @@ function Lib(tbot, tsql) {
this.bot = bot = tbot;
this.sql = sql = tsql;
this.debug = debug = false;
this.cfg = cfg = require('../cfg/main.json');
this.admins = [];
Lib.prototype.loadUser((cb) => {

View File

@ -8,19 +8,21 @@ module.exports = (bot, trigger, lib) => {
name: 'ytdl',
call: /https?:\/\/(www\.)?(yotu\.be\/|youtube\.com\/)?((.+\/)?(watch(\?v=|.+&v=))?(v=)?)([\w_-]{11})(&.+)?/gi,
level: 0,
active: 0,
active: 1,
func: (e) => {
if(e.channel.getName() == '#f0ck') {
if(!e.message.match(/\!ignore$/)) {
if(e.channel.getName() == '#kbot-dev') {
if(!e.message.match(/\!ignore/)) {
var tmp = e.message.match(/https?:\/\/(www\.)?(yotu\.be\/|youtube\.com\/)?((.+\/)?(watch(\?v=|.+&v=))?(v=)?)([\w_-]{11})(&.+)?/gi); // get links
e.reply(tmp);
tmp.forEach((entry,i,a) => {
var dl = true;
var tmpdest = uuid.v1().split('-')[0];
lib.checkRepost(entry, (cbcr) => {
if(cbcr) {
var dat = fs.createWriteStream('./b/'+tmpdest+'.webm');
//ytdl(entry, { filter: (format) => { return format.container === 'webm'; } })
ytdl(entry)
//ytdl(entry)
try {
ytdl(entry, { filter: (format) => { return format.container === 'webm'; } })
.on('response', (res) => {
if(res.headers['content-length'] > lib.cfg.maxFileSize) {
res.destroy();
@ -32,6 +34,11 @@ module.exports = (bot, trigger, lib) => {
//e.reply(err);
})
.pipe( dat );
}
catch(ex) {
e.reply(ex);
dl = false;
}
dat.on('finish', () => {
if(dl) {
dat.close();