diff options
| author | Jules Laplace <jules@okfoc.us> | 2016-11-15 17:59:39 -0500 |
|---|---|---|
| committer | Jules Laplace <jules@okfoc.us> | 2016-11-15 17:59:39 -0500 |
| commit | 61b488785f62aea0cd5f932e7267acd3a12ecb87 (patch) | |
| tree | e2546ff5a73e19d4ef62fd2d111a1be60d3281a8 /lib | |
| parent | 7553643e39a16bacfb2ac6563a8558ac475042bc (diff) | |
le file upload
Diffstat (limited to 'lib')
| -rw-r--r-- | lib/index.js | 9 | ||||
| -rw-r--r-- | lib/panda.js | 4 | ||||
| -rw-r--r-- | lib/upload.js | 2 |
3 files changed, 11 insertions, 4 deletions
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) |
