Giter Club home page Giter Club logo

slack-irc's Introduction

slack-irc Join the chat at https://gitter.im/ekmartin/slack-irc Build Status Coverage Status

Connects Slack and IRC channels by sending messages back and forth. Read more here.

Demo

Slack IRC

Installation and usage

Note: node-irc uses icu-charset-detector as an optional dependency, which might fail to install depending on how you've installed Node.js. slack-irc works fine anyhow though, so no need to worry.

Installing with npm:

$ npm install -g slack-irc
$ slack-irc --config /path/to/config.json

or by cloning the repository:

$ git clone https://github.com/ekmartin/slack-irc.git && cd slack-irc
$ npm install
$ npm run build
$ npm start -- --config /path/to/config.json # Note the extra -- here

It can also be used as a node module:

var slackIRC = require('slack-irc');
var config = require('./config.json');
slackIRC(config);

Configuration

slack-irc uses Slack's bot users. This means you'll have to set up a bot user as a Slack integration, and invite it to the Slack channels you want it to listen in on. This can be done using Slack's /invite <botname> command. This has to be done manually as there's no way to do it through the Slack bot user API at the moment.

slack-irc requires a JSON-configuration file, whose path can be given either through the CLI-option --config or the environment variable CONFIG_FILE. The configuration file needs to be an object or an array, depending on the number of IRC bots you want to run.

This allows you to use one instance of slack-irc for multiple Slack teams if wanted, even if the IRC channels are on different networks.

To set the log level to debug, export the environment variable NODE_ENV as development.

slack-irc also supports invite-only IRC channels, and will join any channels it's invited to as long as they're present in the channel mapping.

Example configuration

Valid JSON cannot contain comments, so remember to remove them first!

[
  // Bot 1 (minimal configuration):
  {
    "nickname": "test2",
    "server": "irc.testbot.org",
    "token": "slacktoken2",
    "channelMapping": {
      "#other-slack": "#new-irc-channel"
    }
  },

  // Bot 2 (advanced options):
  {
    "nickname": "test",
    "server": "irc.bottest.org",
    "token": "slacktoken", // Your bot user's token
    "avatarUrl": "https://robohash.org/$username.png?size=48x48", // Set to false to disable Slack avatars
    "slackUsernameFormat": "<$username>", // defaults to "$username (IRC)"; "$username" overides so there's no suffix or prefix at all
    "ircUsernameFormat": "<$username> ", // defaults to "<$username>"; "$username" overides so there's no suffix or prefix at all
    "autoSendCommands": [ // Commands that will be sent on connect
      ["PRIVMSG", "NickServ", "IDENTIFY password"],
      ["MODE", "test", "+x"],
      ["AUTH", "test", "password"]
    ],
    "channelMapping": { // Maps each Slack-channel to an IRC-channel, used to direct messages to the correct place
      "#slack": "#irc channel-password", // Add channel keys after the channel name
      "privategroup": "#other-channel" // No hash in front of private groups
    },
    "ircOptions": { // Optional node-irc options
      "floodProtection": false, // On by default
      "floodProtectionDelay": 1000 // 500 by default
    },
    // Makes the bot hide the username prefix for messages that start
    // with one of these characters (commands):
    "commandCharacters": ["!", "."],
    // Prevent messages posted by Slackbot (e.g. Slackbot responses)
    // from being posted into the IRC channel:
    "muteSlackbot": true, // Off by default
    // Sends messages to Slack whenever a user joins/leaves an IRC channel:
    "ircStatusNotices": {
      "join": false, // Don't send messages about joins
      "leave": true
    },
    // Prevent messages posted by users on Slack/IRC from being forwarded:
    "muteUsers": {
      "irc": ["irc-user"],
      "slack": ["slack-user"]
    }
  }
]

ircOptions is passed directly to node-irc (available options).

Personal IRC Client

slack-irc strengths mainly lie in many-to-many communication from Slack to IRC (and vice versa), and is thus not very suitable as a makeshift IRC client for one user. If that's what you need, check out aeirola/slack-irc-client, which adds an array of features to solve this problem as smoothly as possible.

Development

To be able to use the latest ES2015+ features, slack-irc uses Babel.

Build the source with:

$ npm run build

Tests

Run the tests with:

$ npm test

Style Guide

slack-irc uses a slightly modified version of the Airbnb Style Guide. ESLint is used to make sure this is followed correctly, which can be run with:

$ npm run lint

The deviations from the Airbnb Style Guide can be seen in the .eslintrc file.

Docker

A third-party Docker container can be found here.

slack-irc's People

Contributors

aketzu avatar andebor avatar bobvandevijver avatar doppins-bot avatar ekmartin avatar grahamb avatar hoosteeno avatar ibuprofen avatar jlaunonen avatar krzys-h avatar laughinghan avatar mathiasose avatar nacx avatar regisb avatar robertkety avatar vilkku avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slack-irc's Issues

Slack replying to IRC stopped working

Any ideas why I would get IRC messages into slack, but my slack replies aren't being sent? It was working initially when I set it up, are there any logs I can upload or anything?

Show who wrote a message in the IRC channel

We've an IRC channel in Slack where multiple users are answering requests. From IRC, it looks like:

orgname: foo
ircuser: orgname: bar

It would be nice if it could look more like the following instead, so it's clearer to IRC users that they're chatting with several people:

orgname: (username via Slack) foo
ircuser: orgname: bar

command=err_cannotsendtochan, rawCommand=404

I was succesfully able to connect to a freenode server. When I try to send a chat from slack though I get:
Received error event from IRC prefix=asimov.freenode.net, server=asimov.freenode.net, command=err_cannotsendtochan, rawCommand=404, commandType=error, args=[getdevs, #csharp, Cannot send to channel]

How does one connect to a freenode chat server and have the ability to send and recieve messages?

Feature request: Buffering messages directed at IRC users who are not present

It seems there's a fairly serious UX issue here, users in slack arn't given join/part messages(and for good reason, they can be extremely noisy), so if they reply to an older message from the other side of the bridge, they often wont be sure that the recipient is still listening, they don't know whether it'll get through. For some public channels where people come and go, it could rarely seem worth it to reply to messages that're more than 10 minutes old.

Suggested solution: buffer messages that contain a single @name, when is not present in either side of the bridge, then relay them to when they rejoin.

cant build project

trying!

$ nvm use stable
Now using node v5.5.0 (npm v3.3.12)
$ npm --version
3.3.12
$ babel lib --out-dir dist
Error: Couldn't find preset "stage-0" relative to directory "/home/cccp/experiment/slack-irc"
at OptionManager.mergePresets (/home/cccp/.nvm/versions/node/v5.5.0/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:327:17)
at OptionManager.mergeOptions (/home/cccp/.nvm/versions/node/v5.5.0/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:287:12)
at OptionManager.addConfig (/home/cccp/.nvm/versions/node/v5.5.0/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:221:10)
at OptionManager.findConfigs (/home/cccp/.nvm/versions/node/v5.5.0/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:364:16)
at OptionManager.init (/home/cccp/.nvm/versions/node/v5.5.0/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/options/option-manager.js:412:12)
at File.initOptions (/home/cccp/.nvm/versions/node/v5.5.0/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/index.js:191:75)
at new File (/home/cccp/.nvm/versions/node/v5.5.0/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/file/index.js:122:22)
at Pipeline.transform (/home/cccp/.nvm/versions/node/v5.5.0/lib/node_modules/babel-cli/node_modules/babel-core/lib/transformation/pipeline.js:42:16)
at transform (/home/cccp/.nvm/versions/node/v5.5.0/lib/node_modules/babel-cli/lib/babel/util.js:53:22)
at Object.compile (/home/cccp/.nvm/versions/node/v5.5.0/lib/node_modules/babel-cli/lib/babel/util.js:62:12)

Some serious spaming

note1989_BOT 8:24 PM [felansu] hello people, any grails programmer here?
[note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [felansu] hello people, any grails programmer here?
skeasorBOT 8:52 PM never knew there was a angularjs on irc...nice
PinglessBOT 8:54 PM I've got a directive with a custom controller, and I need to access the directive's elements from the controller. Is there a way to do that, or should I rethink my approach?
felansuBOT 8:56 PM Pingless: maybe this can help you https://github.com/felansu/QRBWEB/blob/master/src/client/main/app/components/author/create/author.create.controller.js
Oh Pingless, sorry. I read wrong...
i'm thinking in factories...
PinglessBOT 9:02 PM felansu: oh right, I was a little confused...
note1989_BOT 9:02 PM [Pingless] felansu: oh right, I was a little confused...
[note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
PinglessBOT 9:02 PM can someone boot that bot?
note1989_BOT 9:02 PM [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[Pingless] can someone boot that bot?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [Pingless] can someone boot that bot?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [note1989_] [Pingless] can someone boot that bot?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [note1989_] [note1989_] [Pingless] can someone boot that bot?
[note1989_] [note1989_] [note1989_] [note1989_] [Pingless] can someone boot that bot?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] can someone boot that bot?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] can someone boot that bot?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] can someone boot that bot?
[note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [note1989_] [Pingless] felansu: oh right, I was a little confused...

NPM start fails

Hi there,

I was playing around with your code, trying to add server password and server port support but then I ran into this issue:

npm ERR! [email protected] start: `node index.js`
npm ERR! Exit status 8
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is most likely a problem with the slack-irc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node index.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls slack-irc
npm ERR! There is likely additional logging output above.
npm ERR! System Linux 3.16.0-0.bpo.4-amd64
npm ERR! command "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! cwd /root/slack-irc
npm ERR! node -v v0.10.36
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     /root/slack-irc/npm-debug.log
npm ERR! not ok code 0

This happens even after a clean clone from your repo.

Cheers.

Option to allow bot messages

Would be nice if you could add option to allow bot messages to get thru to irc. I'm trying to use this for Jira notifications (and maybe github) via slack. :)

Mirror slack attachments to IRC

Looks like attachments (e.g., a png) in slack don't cause any kind of IRC notification. Granted, you'd probably need a slack account to see it, but might be good to at least provide some notification that it happened incase people want to get a slack account to see it.

Notify when users enter/leave the channel

Sending messages back and forth between Slack and IRC really works great. However, when responding to a user via Slack one often runs into the problem that the user has already left the channel. How much work would it be to send notifications to the Slack channel upon IRC join/leave events? This feature should be configurable.

IRC to private slack channel does not work

Hi,

I have a private group in slack, 'drjkltest' and I am trying to send IRC notices to '#drjkltest'
I have invited the bot to the private channel on slack and it is present.
I can send a message from slack to irc but not from irc to slack.

info: Tried to send a message to a channel the bot isn't in: drjkltest

It works in public channels.

Has something changed?

Add support for channel keys

Tried to get channel keys working, but was unable to do so, and doesn't look to be support for it yet, would be nice to add.

I tried;

"channelMapping": {
"#channel-slack": "#irc-channel:pass"
}

and

"channelMapping": {
"#channel-slack": "#irc-channel pass"
}

with no luck

Config file clarification

Maybe it's just because I'm tired, but it took me a long time to figure out that if you're only defining one bot in the config file, don't forget to take it out of the object brackets that the example includes. For example:

{
    "nickname": "test2",
    "server": "irc.testbot.org",
    "token": "slacktoken2",
    "channelMapping": {
      "#other-slack": "#new-irc-channel"
    }
}

instead of

[
  {
    "nickname": "test2",
    "server": "irc.testbot.org",
    "token": "slacktoken2",
    "channelMapping": {
      "#other-slack": "#new-irc-channel"
    }
  }
]

Maybe a little wiki clarification? If not, at least this is documented so some poor soul doesn't pull their hair out all night.

`process.env.CONFIG_FILE.endsWith('.js')` -- "undefined is not a function"

When trying to run slack-irc, I get the following error:

$ ~/node_modules/.bin/slack-irc
~/node_modules/slack-irc/dist/cli.js:60
  var config = process.env.CONFIG_FILE.endsWith('.js') ? require(completePath)
                                       ^
TypeError: undefined is not a function
    at run (~/node_modules/slack-irc/dist/cli.js:60:40)
    at Object.<anonymous> (~/node_modules/slack-irc/dist/index.js:27:3)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

This happens both when use the CONFIG_FILE env variable, and when use the --config CLI switch.

This is on a Ubuntu 12.04 server, with the following versions:

$ nodejs -v
v0.12.9
$ npm -v
3.5.3

I have literally zero idea of NodeJS (and npm) -- what can I do to make slack-irc work?

Missing Configuration Field Server

I made a config and then go to run the config:
slack-irc --config config.js

Get error thrown:
/usr/local/lib/node_modules/slack-irc/lib/bot.js:17
throw new errors.ConfigurationError('Missing configuration field ' + fie
^
ConfigurationError: Missing configuration field server

Oddly it says there is a configuration field server in fact here is my config as it stands:

[
  {
    "nickname": "ircbot",
    "server": "morgan.freenode.net",
    "token": "<HIDDEN>", // Your bot user's token
    "autoSendCommands": [ // Commands that will be sent on connect
        ["PRIVMSG", "NickServ", "IDENTIFY password"],
        ["MODE", "test", "+x"],
        ["AUTH", "test", "password"]
    ],
    "channelMapping": { // Maps each Slack-channel to an IRC-channel, used to direct messages to the correct place
      "#slack": "#irc-test", // Add channel keys after the channel name
    }
  }
]

Any advice?

Issue with outgoing webhook

First of all, thanks for this, @ekmartin - this is exactly what I was looking for.

I got everything set up using the readme, but unfortunately I'm running into an issue with the outgoing webhook. I can get messages into Slack from IRC, but outgoing messages aren't working at all.

  • I added the URL to my server to the webhook settings (using port 3000 based on what I was able to find poking around the code) and it doesn't seem to be responding.
  • I tried to throw some POSTs at it using Postman, too, but I'm getting a 404. Additionally, Slack sent me an email saying the outgoing webhook wasn't working properly.

I did my best to figure this out by reading and trying different things, but I'm not sure what else to do.

Is there an additional setup step I am missing? I'll gladly make up a PR with the additional steps to help other folks, as well.

Thanks for any input!

User Lists and Avatars

Hello!

I've just installed this and it's working great! I do have a couple questions I'd like to ask though...

  1. Is there a way to get users on slack from irc and irc from slack?
  2. Is there a way to customize the avatars, or a way to edit them?

Thanks for this fantastic plugin!
-Rez

Allow customization of Slack/IRC username format

Right now everything is posted to Slack with the username of the IRC message author. This sometimes causes confusion from people that doesn't know where the messages are coming from, especially in large channels.

An option could be adding a slackUsernameFormat config option with username interpolation, so for example $username (IRC) would result in messages being posted by ekmartin (IRC) instead of just ekmartin. Could also have an ircUsernameFormat which would default to <$username>, which would allow stuff like #19.

Another option would of course just be to change the default representation from just username to something suffixed with (sent from IRC) or similar. The less config options the better, however as this would be a breaking change with little flexibility I'm not sure.

Any feedback is welcome.

Improve Docker workflow

Hi there,

I have created an Alpine Linux based Docker image for slack-irc. Compared to @caktux image, this takes up 27MB of disk space instead of 400MB and builds in about 20 seconds instead of 3 minutes 50 seconds.

I you don't want to build the image yourself, you can even pull it from the Docker Hub. This takes about 10 seconds.

Cheers.

Missing "babel-polyfill" dependency?

Hey again, after having #70 fixed in v3.7.1, I've tried running slack-irc again. This time, I got a different error :/

$ ~/node_modules/.bin/slack-irc --config slackrelay_config.json
module.js:338
    throw err;
          ^
Error: Cannot find module 'babel-polyfill'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (~/node_modules/slack-irc/dist/index.js:8:1)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Function.Module.runMain (module.js:501:10)

Since this seemed to me like a missing dependency-entry, I manually installed babel-polyfill and tried again, with no luck:

$ npm install babel-polyfill
~
β”œβ”€β”¬ [email protected]
β”‚ β”œβ”€β”€ [email protected]
β”‚ β”œβ”€β”€ [email protected]
β”‚ └── [email protected]
└── [email protected]

$ ~/node_modules/.bin/slack-irc --config slackrelay_config.json
[Mon Jan 11 2016 18:27:06 GMT+0000 (GMT)] INFO Connecting...
~/node_modules/irc/lib/irc.js:751
                        throw err;
                              ^
TypeError: Cannot read property 'map' of undefined
    at Bot.sendToSlack (~/node_modules/slack-irc/dist/bot.js:260:59)
    at Client.emit (events.js:118:17)
    at Client.<anonymous> (~/node_modules/irc/lib/irc.js:519:22)
    at Client.emit (events.js:107:17)
    at iterator (~/node_modules/irc/lib/irc.js:748:26)
    at Array.forEach (native)
    at Socket.<anonymous> (~/node_modules/irc/lib/irc.js:743:15)
    at Socket.emit (events.js:107:17)
    at readableAddChunk (_stream_readable.js:163:16)
    at Socket.Readable.push (_stream_readable.js:126:10)

This is, as before, on a Ubuntu 12.04 with:

$ nodejs -v
v0.12.9
$ npm -v
3.5.3

Any ideas about this?

Flood protection

While I haven't hit this yet (just started running this today) - I noticed some folks on the web talking about issues with flood protection when mirroring slack & irc.

The irc module has support for this so it might be nice to have a way to pass the flag down from the slack-irc config to make use of it.

Thanks!

AUTH ?

  ["AUTH", "test", "password"]

that isent even a irc command ?

Also can you add some documentation on what thoes messages are for ?

[Sat Sep 05 2015 12:00:54 GMT-0400 (EDT)] INFO Connecting...
error: Received error event from IRC prefix=weber.freenode.net, server=weber.freenode.net, command=err_unknowncommand, rawCommand=421, commandType=error, args=[irc-bot, AUTH, Unknown command]

Give Don a break. Username highlighting tweak.

I have a user in my slack with the name of don, unfortunately the user is notified any time someone writes don't due to the way the regex is setup in the highlightUsername function.

I have a small code change which does not break the tests and allows don to get relief from the notifications. The regex will look for usernames with a colon or comma as part of the word, if not, they are not highlighted. This will still allow username: and username, blah but not username's.

If this is disired I will open a PR. What do you think? Thanks.

Images

Feature request: When uploading image through Slack, show url on IRC-channel.

Presence awareness

From a cursory look through the Slack API this does not seem possible, but I will through it here to get more feedback.

One drawback of using an IRC bridge is that presence awareness is impacted. People on IRC do not know who's is online behind the bot and vice-versa.

Ideally, it should be possible to create "fake" users in Slack to represent people on IRC. Doing the same on IRC would be tricky to say the least.

That being said, perhaps relaying join/part/quit messages would be interesting, but I'm not sure how annoying that would be (or useful, because people would have to parse the channel instead of checking a user list).

Custom emoji support

Could be good to allow emoji extension to cover emoji that are posted to a given slack org.

Maybe something nested under the config?

After running for a while, Slack messages are no longer sent to IRC

Pretty much what the title says. I am unsure of exact times slack-irc needs to be running, but I would estimate about a week (could note for the record that it happened again just now). IRC messages continue to be sent to Slack without problems, which makes it a bit difficult to spot.

I'm running 3.5.2.

Forward commands from slack to irc w/o prefacing with nick

Enjoying slack-irc very much. Thank you! I was wondering if it is possible to forward commands from slack to IRC without the bot prepending the nick that issued the command. Our commands are started with an explanation point "!". For example:

07:29 < jdog> !netintime
07:29 < Karsten> Fremont: 07:29 Varberg/MalmΓΆ: 16:29 Kelowna: 07:29 Seoul: 23:29 Melbourne: 00:29 Hong Kong: 22:29 Boston: 10:29

If we try from slack, the "!" isn't the first character on the line, our nick is. For example:
07:30 < McBot> !netintime
No results. The line above should have the nick listed between mcbot's nick and the command. When I save this comment, it disappeared - making it look how I envision the command should be sent.

Thanks again!

How to setup multiple channels within one team

First of all: Great tool!
I have an issue with setting up multiple channels ithin one team.

I can talk from IRC to slack on multiple channels without issue, but so far I only managed to talk on one channel from slack to IRC.

I've created an outgoing webhook for every channel I want to export. But every webhook has it's own token. And as far as I see it only one token can be added to the team-configuration. The channel I configured the token for is the one I can talk from slack to IRC. When I change the token, the channel changes.

How can I talk from slack to IRC on multiple channels?

IRC Notifications not sent to Slack

This is a very slick tool. Good job. It's helping to bridge the two systems for us. Is there anyway to get IRC notifications sent to Slack as well?

An example:
15:44 -ovplus_:#ptac- [#29139 New] "How Can We Push This To Slack?" from ABC Company (https://ABCCompany.com/90000040000ngSsoAAE)
15:44 < jdog> Level_1: just a test ^ I will delete

The first entry does not get pushed, the second does.

Ability to remove nick from irc display

When commenting from slack client, back to irc it looks like;

my comment

it'd be nice if there was an option to simply disable the so it's not double entering my nickname on commenting back to irc.

registering to nickserve

I'm using these to try and auth with nickserve, all give a similar error;

"autoSendCommands": [
["MODE", "myircnickname", "+x"],
["MSG", "nickserv", "identify THISISMYPASSWORD"]
],

and
"autoSendCommands": [
["MODE", "myircnickname", "+x"],
["AUTH", "myircnickname", "THISISMYPASSWORD"]
],

and

"autoSendCommands": [
["MODE", "myircnickname", "+x"],
["AUTH", "nickserv", "identify THISISMYPASSWORD"]
],

ERROR

[Fri Mar 27 2015 19:38:26 GMT-0500 (CDT)] INFO Connecting...
27 Mar 19:38:26 - SEND: NICK myircnickname
27 Mar 19:38:26 - SEND: USER myircnickname 8 * myircnickname
27 Mar 19:38:27 - SEND: MODE myircnickname +x
27 Mar 19:38:27 - SEND: MSG nickserv :identify THISISMYPASSWORD
27 Mar 19:38:27 - Unhandled message: { prefix: 'verne.freenode.net',
server: 'verne.freenode.net',
command: 'rpl_luserunknown',
rawCommand: '253',
commandType: 'reply',
args: [ 'myircnickname', '9', 'unknown connection(s)' ] }
27 Mar 19:38:27 - SEND: JOIN #channel1 password
27 Mar 19:38:27 - SEND: JOIN #channel2
27 Mar 19:38:27 - MODE: myircnickname sets mode: +i
27 Mar 19:38:27 - GOT NOTICE from "NickServ": "This nickname is registered. Please choose a different nickname, or identify via /msg NickServ identify ."
error: Received error event from IRC prefix=verne.freenode.net, server=verne.freenode.net, command=err_unknowncommand, rawCommand=421, commandType=error, args=[myircnickname, MSG, Unknown command]
error: Received error event from IRC prefix=verne.freenode.net, server=verne.freenode.net, command=err_badchannelkey, rawCommand=475, commandType=error, args=[myircnickname, #channel1, Cannot join channel (+k) - bad key]
27 Mar 19:38:32 - SEND: MODE #channel2
27 Mar 19:38:32 - Unhandled message: { prefix: 'services.',
server: 'services.',
command: '328',
rawCommand: '328',
commandType: 'normal',
args: [ 'myircnickname', '#channel2', 'some message' ] }

SASL+SSL support?

Hello --

First off thanks for this awesome code. Its helpful and Im glad to see it curated. πŸ‘ πŸ˜„

I was wondering if SASL support works as intended. As best as I can tell, Im striking out using SASL combined with SSL. The README links to http://node-irc.readthedocs.org/en/latest/API.html#irc.Client, but using what I think are relevant ircOptions dont seem to work.

[
  {
    "nickname": "botnick",
    "server": "irc.company.corp",
    "token": "slacktoken",
    "channelMapping": {
      "#slackchan": "#ircchan"
    },
    "ircOptions": {
      "floodProtection": false,
      "floodProtectionDelay": 1000,
      "userName": "botnick",
      "port": 6697,
      "sasl": true,
      "secure": true,
      "selfSigned": true,
      "certExpired": true,
      "debug": true,
      "nick": "botnick",
      "userName": "botnick",
      "password": "pass"
    }
  }
]
$ node index.js
[Wed Jun 03 2015 00:37:22 GMT+0000 (UTC)] INFO Connecting...
3 Jun 00:37:22 - SEND: PASS pass
3 Jun 00:37:22 - Sending irc NICK/USER
3 Jun 00:37:22 - SEND: NICK botnick
3 Jun 00:37:22 - SEND: USER botnick 8 * botnick
3 Jun 00:37:24 - Unhandled message: { command: 'ERROR',
  rawCommand: 'ERROR',
  commandType: 'normal',
  args: [ 'Closing link: ([email protected]) [Access denied by configuration]' ] }
3 Jun 00:37:24 - Connection got "close" event
3 Jun 00:37:24 - Disconnected: reconnecting
3 Jun 00:37:24 - Waiting 2000ms before retrying
3 Jun 00:37:24 - Connection got "end" event

Curious. Thanks so much!

Γ† ΓΈ Γ₯

The bot doesn't seem to support Γ¦ ΓΈ Γ₯ :( (or is incorrectly configured for Hackerspace's slack)

ceqqdpv

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.