From 61b488785f62aea0cd5f932e7267acd3a12ecb87 Mon Sep 17 00:00:00 2001 From: Jules Laplace Date: Tue, 15 Nov 2016 17:59:39 -0500 Subject: le file upload --- lib/index.js | 9 +++++++-- lib/panda.js | 4 +++- lib/upload.js | 2 +- 3 files changed, 11 insertions(+), 4 deletions(-) (limited to 'lib') diff --git a/lib/index.js b/lib/index.js index a9571f8..6da1c24 100644 --- a/lib/index.js +++ b/lib/index.js @@ -20,7 +20,13 @@ router.post("/_irc/image", multer_upload.single('image'), function(req, res){ res.json({ error: err }) }, success: function(url){ - server.io.send("link", {url: url}) + console.log("SUCCSES!") + console.log(url) + panda.say(panda.channels[0], url) + server.io.emit("link", { + nick: panda.nick, + url: url, + }) } }) }) @@ -40,7 +46,6 @@ router.post("/_irc/post", function(req, res){ }) panda.watch(panda.channels[0], /(https?:\/\/[^\s]+)/g, function(data){ - console.log(data) data.match.forEach(function(match){ server.io.emit("link", { nick: data.nick, diff --git a/lib/panda.js b/lib/panda.js index 1757121..d4cb59f 100644 --- a/lib/panda.js +++ b/lib/panda.js @@ -6,9 +6,11 @@ var TASK_DELAY = 800 var panda = {} +panda.nick = process.env.IRC_NICK +panda.server = process.env.IRC_SERVER panda.channels = process.env.IRC_CHANNELS.split(",") -var client = panda.client = new irc.Client( process.env.IRC_SERVER, process.env.IRC_NICK, { +var client = panda.client = new irc.Client( panda.server, panda.nick, { userName: process.env.IRC_NAME, realName: process.env.IRC_REALNAME, port: process.env.IRC_PORT, diff --git a/lib/upload.js b/lib/upload.js index 62ed9de..85b287a 100644 --- a/lib/upload.js +++ b/lib/upload.js @@ -57,7 +57,7 @@ module.exports.put = function (key, file, opt) { } var file_url = s3res.url || s3res.req.url - +console.log(file_url) opt.success && opt.success(file_url) }).on('error', function(err, s3res){ console.error("error", err) -- cgit v1.2.3-70-g09d2