muh
This commit is contained in:
parent
dbb14b3a5c
commit
69a8706552
|
@ -32,7 +32,7 @@
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
setTimeout(scrollListener, 50);
|
setTimeout(scrollListener, 200);
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
$(document).ready(function () {
|
$(document).ready(function () {
|
||||||
|
|
|
@ -5,7 +5,7 @@ var exec = require('child_process').exec;
|
||||||
var probe = require('node-ffprobe');
|
var probe = require('node-ffprobe');
|
||||||
var crypto = require('crypto');
|
var crypto = require('crypto');
|
||||||
var Mime = require('mime');
|
var Mime = require('mime');
|
||||||
var cfg = require('../cfg/main.json');
|
var cfg;
|
||||||
|
|
||||||
var bot, sql, debug;
|
var bot, sql, debug;
|
||||||
|
|
||||||
|
@ -14,6 +14,7 @@ function Lib(tbot, tsql) {
|
||||||
this.bot = bot = tbot;
|
this.bot = bot = tbot;
|
||||||
this.sql = sql = tsql;
|
this.sql = sql = tsql;
|
||||||
this.debug = debug = false;
|
this.debug = debug = false;
|
||||||
|
this.cfg = cfg = require('../cfg/main.json');
|
||||||
this.admins = [];
|
this.admins = [];
|
||||||
|
|
||||||
Lib.prototype.loadUser((cb) => {
|
Lib.prototype.loadUser((cb) => {
|
||||||
|
|
|
@ -8,19 +8,21 @@ module.exports = (bot, trigger, lib) => {
|
||||||
name: 'ytdl',
|
name: 'ytdl',
|
||||||
call: /https?:\/\/(www\.)?(yotu\.be\/|youtube\.com\/)?((.+\/)?(watch(\?v=|.+&v=))?(v=)?)([\w_-]{11})(&.+)?/gi,
|
call: /https?:\/\/(www\.)?(yotu\.be\/|youtube\.com\/)?((.+\/)?(watch(\?v=|.+&v=))?(v=)?)([\w_-]{11})(&.+)?/gi,
|
||||||
level: 0,
|
level: 0,
|
||||||
active: 0,
|
active: 1,
|
||||||
func: (e) => {
|
func: (e) => {
|
||||||
if(e.channel.getName() == '#f0ck') {
|
if(e.channel.getName() == '#kbot-dev') {
|
||||||
if(!e.message.match(/\!ignore$/)) {
|
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
|
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) => {
|
tmp.forEach((entry,i,a) => {
|
||||||
var dl = true;
|
var dl = true;
|
||||||
var tmpdest = uuid.v1().split('-')[0];
|
var tmpdest = uuid.v1().split('-')[0];
|
||||||
lib.checkRepost(entry, (cbcr) => {
|
lib.checkRepost(entry, (cbcr) => {
|
||||||
if(cbcr) {
|
if(cbcr) {
|
||||||
var dat = fs.createWriteStream('./b/'+tmpdest+'.webm');
|
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) => {
|
.on('response', (res) => {
|
||||||
if(res.headers['content-length'] > lib.cfg.maxFileSize) {
|
if(res.headers['content-length'] > lib.cfg.maxFileSize) {
|
||||||
res.destroy();
|
res.destroy();
|
||||||
|
@ -32,6 +34,11 @@ module.exports = (bot, trigger, lib) => {
|
||||||
//e.reply(err);
|
//e.reply(err);
|
||||||
})
|
})
|
||||||
.pipe( dat );
|
.pipe( dat );
|
||||||
|
}
|
||||||
|
catch(ex) {
|
||||||
|
e.reply(ex);
|
||||||
|
dl = false;
|
||||||
|
}
|
||||||
dat.on('finish', () => {
|
dat.on('finish', () => {
|
||||||
if(dl) {
|
if(dl) {
|
||||||
dat.close();
|
dat.close();
|
||||||
|
|
Loading…
Reference in New Issue
Block a user