From 77a800c25dd9a5967facf414d18a577a9ef1c6d3 Mon Sep 17 00:00:00 2001 From: Guillaume Boudreau Date: Wed, 4 Jun 2014 20:13:14 -0400 Subject: [PATCH] Default bind interface is now 0.0.0.0 (was localhost), and default port is 2666 (was 666). Fixes #4, #5 and #10 --- slack.patch | 72 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) create mode 100644 slack.patch diff --git a/slack.patch b/slack.patch new file mode 100644 index 0000000..3ea04fd --- /dev/null +++ b/slack.patch @@ -0,0 +1,72 @@ +diff --git config.js config.js +index eb36c35..b28bfd9 100644 +--- config.js ++++ config.js +@@ -1,19 +1,19 @@ + module.exports = { + slack: { +- host: 'my.slack.com', +- incomingWebhookToken: 'your incoming webhook token', +- outgoingWebhookToken: 'your outgoing webhook token', ++ host: 'galaxy.slack.com', ++ incomingWebhookToken: 'asiefBea1QKebUmyDdfIw2uf', ++ outgoingWebhookToken: 'KkHkBgv8rSCrumt87yXlorC3', + outgoingWebhookServer: { +- port: 666, +- domain: 'your.webhook.server.com', ++ port: 8999, ++ domain: 'orangehack.com', + hookPath: '/irc-echo' + }, +- echoChannel: '#irc-echo', +- botName: 'IRCBot', ++ echoChannel: '#dbtst', ++ botName: 'slackbot', + }, + irc: { +- server: 'your.irc.net', +- nick: 'slackbot', +- channel: '#mychan' ++ server: 'chat.freenode.net', ++ nick: 'gxyslackbot', ++ channel: '#dannon_test' + }, + }; +diff --git lib/slack.js lib/slack.js +index 22758e5..1b0a9ce 100644 +--- lib/slack.js ++++ lib/slack.js +@@ -156,12 +156,16 @@ var slackBotMethods = { + var handleSlackInput = function(payload) { + if (ircClient) { + // remove trigger word +- var deTriggered = payload.text.slice(payload.trigger_word.length); ++ //var deTriggered = payload.text.slice(payload.trigger_word.length); ++ var deTriggered = payload.text + var words = deTriggered.split(' '); ++ if (payload.user_name === config.slack.botName){ ++ // Discard the slack-side bot's (usually slackbot) chatter. ++ return; ++ } + if (words[0] == ':') { + words = words.slice(1); + } +- + var command = words[0]; + payload.commandless_words = words.slice(1); + if (_.has(slackBotMethods, command)) { +diff --git userMap.json userMap.json +index 9e90b28..5559013 100644 +--- userMap.json ++++ userMap.json +@@ -1,8 +1 @@ +-{ +- // you'll get a parse error unless you remove these comments +- // i've kept the comments in so this deliberately breaks. +- // this file will eventually be dynamically written to, but +- // in the meantime, bootstrap it with one or two irc/slack pairs. +- +- /* "irc_username": "slack_username", */ +-} ++{"dannon":"dannon"} +\ No newline at end of file