ytdl fix
This commit is contained in:
parent
d1373f94b4
commit
d250f32e7f
|
@ -1,6 +1,7 @@
|
|||
var fs = require('fs-extra');
|
||||
var ytdl = require('ytdl-core');
|
||||
var uuid = require('uuid');
|
||||
var cfg = require('../../cfg/main.json');
|
||||
|
||||
module.exports = (bot, lib) => {
|
||||
lib.trigger.add({
|
||||
|
@ -24,10 +25,10 @@ module.exports = (bot, lib) => {
|
|||
try {
|
||||
ytdl.downloadFromInfo(info, { filter: (format) => { return format.container === 'webm'; } })
|
||||
.on('response', (res) => {
|
||||
if(res.headers['content-length'] > lib.cfg.maxFileSize) {
|
||||
if(res.headers['content-length'] > cfg.maxFileSize) {
|
||||
res.destroy();
|
||||
dl = false;
|
||||
e.reply('f0ck! your file is too big (~'+lib.formatSize(res.headers['content-length'])+'), max '+lib.formatSize(lib.cfg.maxFileSize)+' allowed');
|
||||
e.reply('f0ck! your file is too big (~'+lib.formatSize(res.headers['content-length'])+'), max '+lib.formatSize(cfg.maxFileSize)+' allowed');
|
||||
}
|
||||
})
|
||||
.on('error', (err) => {
|
||||
|
|
Loading…
Reference in New Issue
Block a user