modified: src/main.js

This commit is contained in:
Flummi 2016-08-14 16:54:37 +02:00
parent 93653c5e53
commit 97bf115120

View File

@ -66,7 +66,7 @@ bot.on('message', (e) => {
tmpuser['nick'], tmpuser['nick'],
e.channel.getName(), e.channel.getName(),
e.network, e.network,
new Date().getTime(), Math.floor(new Date() / 1000),
0 0
]).on('result', (result) => { ]).on('result', (result) => {
@ -108,9 +108,7 @@ var getUser = (u, n) => {
}; };
var dl = (url, dest, cb) => { var dl = (url, dest, cb) => {
var request = (url.match(/^https/)?https:http).get(url, (response) => { var request = (url.match(/^https/)?https:http).get(url, (response) => { // type:1=post,type:2=stfu
try { // type:1=post,type:2=stfu
console.log(response.headers['content-type']);
if(allowed.indexOf(response.headers['content-type']) != -1) { if(allowed.indexOf(response.headers['content-type']) != -1) {
if(response.headers['content-length'] <= maxFileSize) { if(response.headers['content-length'] <= maxFileSize) {
checkRepost(url, (cbcr) => { checkRepost(url, (cbcr) => {
@ -139,10 +137,8 @@ var dl = (url, dest, cb) => {
else { else {
cb({'status':false, 'msg':'f0ck you', 'type':2}); cb({'status':false, 'msg':'f0ck you', 'type':2});
} }
} }).on('error', (msg) => {
catch(ex) { cb({'status':false, 'msg':msg, 'type':2});
e.reply(ex);
}
}); });
}; };