diff --git a/bot.js b/bot.js index 2bf30bf..9d80793 100644 --- a/bot.js +++ b/bot.js @@ -26,7 +26,7 @@ var child = new (forever.Monitor)(__dirname+'/src/main.js', { silent: false, cwd: __dirname, args: [], - spinSleepTime: 2000, + spinSleepTime: 5000, watch: true, watchIgnoreDotFiles: true, watchIgnorePatterns: [ diff --git a/src/trigger/parser.js b/src/trigger/parser.js index 92127e4..36b3d0c 100644 --- a/src/trigger/parser.js +++ b/src/trigger/parser.js @@ -84,7 +84,7 @@ module.exports = (lib) => { .on('response', (res) => { if(res.headers['content-length'] > cfg.maxFileSize) { res.destroy(); - dat.close(); + dat.end(); cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(res.headers['content-length'])+'), max '+lib.formatSize(cfg.maxFileSize)+' allowed' }); } else { @@ -98,13 +98,13 @@ module.exports = (lib) => { } }) .on('error', (err) => { - dat.close(); - cb({ success: false, file: tmpdest, msg: ex }); + dat.end(); + cb({ success: false, file: tmpdest, msg: err.message }); }) .pipe(dat); } catch(ex) { - dat.close(); + dat.end(); cb({ success: false, file: tmpdest, msg: ex.message }); } } @@ -125,7 +125,7 @@ module.exports = (lib) => { }; } else { - dat.close(); + dat.end(); cb({ success: false, file: tmpdest, msg: 'f0ck sc-api' }); } }); @@ -156,17 +156,17 @@ module.exports = (lib) => { }; } else { - dat.close(); + dat.end(); cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(data.length)+'), max '+lib.formatSize(cfg.maxFileSize)+' allowed' }); } } else { - dat.close(); + dat.end(); cb({ success: false, file: tmpdest, msg: '' }); } } else { - dat.close(); + dat.end(); cb({ success: false, file: tmpdest, msg: err }); } }); @@ -175,7 +175,7 @@ module.exports = (lib) => { dat .on('finish', () => { var size = dat.bytesWritten; - dat.close(); + dat.end(); if(size > cfg.maxFileSize) cb({ success: false, file: tmpdest, msg: 'f0ck! your file is too big (~'+lib.formatSize(size)+'), max '+lib.formatSize(cfg.maxFileSize)+' allowed' }); else {