modified: src/main.js

This commit is contained in:
Flummi 2016-08-14 02:57:19 +02:00
parent 71bff2ef5b
commit 21a3ec84e9

View File

@ -48,7 +48,7 @@ bot.on('message', (e) => {
}); });
}); });
} }
else if(orig.match(/^\.user/)) { // (debug) get userinfos else if(orig.match(/^\.user/)) { // (debug) get userinfos
var tmp = getUser(e.user.getNick(), e.network); var tmp = getUser(e.user.getNick(), e.network);
setTimeout(()=>{ e.reply(tmp); }, 1500); setTimeout(()=>{ e.reply(tmp); }, 1500);
} }
@ -67,7 +67,7 @@ var dl = (url, dest, cb) => {
var file = fs.createWriteStream(dest); var file = fs.createWriteStream(dest);
var request = (url.match(/^https/)?https:http).get(url, (response) => { var request = (url.match(/^https/)?https:http).get(url, (response) => {
try { try {
if(allowed.indexOf(response.headers['content-type']) != -1) { if(allowed.indexOf(response.headers['content-type']) != -1) {
response.pipe(file); response.pipe(file);
file.on('finish', () => { file.on('finish', () => {
file.close(); file.close();
@ -75,13 +75,13 @@ var dl = (url, dest, cb) => {
}); });
file.on('error', (err) => { file.on('error', (err) => {
fs.unlink(dest); fs.unlink(dest);
file.close(); file.close();
cb({'status':false, 'msg':err.message}); cb({'status':false, 'msg':err.message});
}); });
} }
else { else {
cb({'status':false, 'msg':'f0ck you'}); cb({'status':false, 'msg':'f0ck you'});
} }
} }
catch(ex) { catch(ex) {
e.reply(ex); e.reply(ex);