Coder Social home page Coder Social logo

hubot-irc's Introduction

Hubot IRC Adapter

Travis-CI Build Status

Build Status npm version

Description

This is the IRC adapter for hubot. For discussion about this adapter, join #hubot-irc on irc.freenode.net. For convenience you can #hubot-irc using webchat.freenode.net/

Installation and Setup

To get your own hubot up and running we recommend following the Getting Started directions from the hubot wiki, they are summarized here:

% npm install -g yo generator-hubot
% mkdir myhubot
% cd myhubot
% yo hubot --adapter=irc
% HUBOT_IRC_SERVER=irc.freenode.net \
  HUBOT_IRC_ROOMS="#myhubot-irc" \
  HUBOT_IRC_NICK="myhubot" \
  HUBOT_IRC_UNFLOOD="true" \
  bin/hubot -a irc --name myhubot

Note: The default hubot configuration will use a redis based brain that assumes the redis server is already running. Either start your local redis server (usually with redis-start &) or remove the redis-brain.coffee script from the default hubot-scripts.json file.

Configuring the Adapter

The IRC adapter requires only the following environment variables.

  • HUBOT_IRC_SERVER
  • HUBOT_IRC_ROOMS
  • HUBOT_IRC_NICK

And the following are optional.

  • HUBOT_IRC_PORT
  • HUBOT_IRC_USERNAME
  • HUBOT_IRC_PASSWORD
  • HUBOT_IRC_NICKSERV_PASSWORD
  • HUBOT_IRC_NICKSERV_USERNAME
  • HUBOT_IRC_SERVER_FAKE_SSL
  • HUBOT_IRC_SERVER_CERT_EXPIRED
  • HUBOT_IRC_UNFLOOD
  • HUBOT_IRC_DEBUG
  • HUBOT_IRC_USESSL
  • HUBOT_IRC_PRIVATE
  • HUBOT_IRC_USESASL

IRC Server

This is the full hostname or IP address of the IRC server you want your hubot to connect to. Make a note of it.

IRC Rooms

This is a comma separated list of the IRC channels you want your hubot to join. They must include the #. Make a note of them. You can join private channels by simply appending the channel password to the room, e.g. #private password.

IRC Nick

This is the optional nick you want your hubot to join with. If omitted it will default to the name of your hubot.

IRC Port

This is the optional port of the IRC server you want your hubot to connect to. If omitted the default is 6667. Make a note of it if required.

IRC User & Password

This is the optional username and/or password of the IRC server you want your hubot to connect to. If the IRC server doesn't require a username/password, this can be omitted. Make a note of it if required.

IRC Nickserv Password

This is the optional Nickserv password if your hubot is using a nick registered with Nickserv on the IRC server. Make a note of it if required.

IRC Nickserv Username

This is the optional Nickserv username if your hubot is using a nick registered with Nickserv on the IRC server, e.g. /msg NickServ identify <username> <password>.

IRC Server Fake SSL

This is the optional flag if you want to accept self signed SSL certificated from a non trusted CA. You can set the variable to anything.

IRC Server Expired Certificate

This is the optional flag if you want to accept an expired SSL certificate.

IRC Unflood

This is the optional flag if you want to protect your hubot from flooding channels with messages. It will queue messages and slowly send. You can set the variable to any truthy value or a number; if a number is given we will interpret it as a wait time in milliseconds to use between sending messages.

IRC Debug

This is the optional flag which will display debug output. You can set the variable to anything.

IRC Use SSL

This is the optional flag if your hubot is connecting to an IRC server using SSL. You can set the variable to anything.

IRC Private

This is the optional flag if your hubot should ignore PRIVMSG and INVITE commands. You can set the variable to anything.

IRC SASL

SASL is a method that allows identification to services (NickServ) during the connection process, before anything else happens - therefore eliminating the need to /msg nickserv identify. Note: May be a requirement from some IRC hosts (freenode) when connecting from a public cloud provider (AWS).

Configuring the variables on Heroku

% heroku config:add HUBOT_IRC_SERVER="..."

% heroku config:add HUBOT_IRC_ROOMS="#foo,#bar"

Optional

% heroku config:add HUBOT_IRC_NICK="..."

% heroku config:add HUBOT_IRC_PORT=6767

% heroku config:add HUBOT_IRC_USERNAME="..."

% heroku config:add HUBOT_IRC_PASSWORD="..."

% heroku config:add HUBOT_IRC_NICKSERV_PASSWORD="..."

% heroku config:add HUBOT_IRC_SERVER_FAKE_SSL="true"

% heroku config:add HUBOT_IRC_UNFLOOD="true"

% heroku config:add HUBOT_IRC_DEBUG="true"

% heroku config:add HUBOT_IRC_USESSL="true"

% heroku config:add HUBOT_IRC_USESASL="true"

Configuring the variables on UNIX

% export HUBOT_IRC_SERVER="..."

% export HUBOT_IRC_ROOMS="#foo,#bar"

Optional

% export HUBOT_IRC_NICK="..."

% export HUBOT_IRC_PORT=6767

% export HUBOT_IRC_USERNAME="..."

% export HUBOT_IRC_PASSWORD="..."

% export HUBOT_IRC_NICKSERV_PASSWORD="..."

% export HUBOT_IRC_SERVER_FAKE_SSL="true"

% export HUBOT_IRC_UNFLOOD="true" # Can optionally be passed a number (in milliseconds) that will be used as the delay between messages

% export HUBOT_IRC_DEBUG="true"

% export HUBOT_IRC_USESSL="true"

% export HUBOT_IRC_USESASL="true"

Configuring the variables on Windows

From Powershell:

setx HUBOT_IRC_SERVER "..." /m

setx HUBOT_IRC_ROOMS "#foo,#bar" /m

Testing Local Changes

gem install foreman
git clone https://github.com/github/hubot.git
cd hubot
# this next line makes a deployable version of the bot for heroku or local deployments
make package 
mv hubot/ ../testbot
cd ../testbot
- modify package.json to include the version of hubot-irc to test with either an official release or from your local repo
    for an example see this https://gist.github.com/3148311
- modify Procfile, change adapter (-a option) to "irc" and change the name (-n option) of the bot
- make sure you followed the usage section from above to set the environment variables (Non-Heroku section)
foreman start

...and that is it

Contribute

Here's the most direct way to get your work merged into the project.

  1. Fork the project
  2. Clone down your fork
  3. Create a feature branch
  4. Hack away and add tests, not necessarily in that order
  5. Make sure everything still passes by running tests
  6. If necessary, rebase your commits into logical chunks without errors
  7. Push the branch up to your fork
  8. Send a pull request for your branch

Copyright

Copyright © Hubot Irc Community Contributors. MIT License; see LICENSE for further details.

hubot-irc's People

Contributors

5thwall avatar audaxion avatar benoitzugmeyer avatar chrisdotcode avatar christiangaertner avatar elliotttf avatar fabianfrank avatar halkeye avatar hashbrowncipher avatar jamesob avatar jgable avatar joshbetz avatar justafish avatar kmnk avatar nandub avatar notpeter avatar parkr avatar patcon avatar pboos avatar pgolm avatar phily245 avatar radnor avatar rgbkrk avatar saebekassebil avatar smgt avatar stanaka avatar stephenyeargin avatar suisho avatar take-cheeze avatar tombell 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

hubot-irc's Issues

Not correctly keeping track of users in the room

Hubot should know who is currently in a room, I think. hubot-irc (despite my earlier fix to detect people leaving) still doesn't seem to manage this properly. It doesn't notice when people change name, and also doesn't reliably notice when people leave still. I intend to have a look at this at some point in our own fork at http://github.com/theodi/hubot-irc, but I thought this was the best place to file it.

no method 'robot'

I've seen this issue listed here before, but I'm having the same issue as well. Downloaded 2.3.2 release and added the dependencies, ran npm install hubot-irc --save, npm install coffee-script --save, and npm install

2013-06-17T06:08:52.989801+00:00 heroku[app.1]: State changed from starting to up
2013-06-17T06:08:53.023127+00:00 app[app.1]: [Mon Jun 17 2013 06:08:53 GMT+0000 (UTC)] ERROR Cannot load adapter irc - TypeError: Object #<Object> has no method 'robot'
2013-06-17T06:08:53.023127+00:00 app[app.1]: TypeError: Object #<Object> has no method 'robot'
2013-06-17T06:08:53.023127+00:00 app[app.1]:   at Module._compile (module.js:446:26)
2013-06-17T06:08:53.023127+00:00 app[app.1]:   at Object.loadFile (/app/node_modules/coffee-script/lib/coffee-script/coffee-script.js:182:19)
2013-06-17T06:08:53.023127+00:00 app[app.1]:   at Function.Module._load (module.js:311:12)
2013-06-17T06:08:53.023127+00:00 app[app.1]:   at Object.<anonymous> (/app/node_modules/hubot-irc/src/irc.coffee:1:11, <js>:7:28)
2013-06-17T06:08:53.023127+00:00 app[app.1]:   at Object.<anonymous> (/app/node_modules/hubot-irc/src/irc.coffee:1:1, <js>:207:4)
2013-06-17T06:08:53.023127+00:00 app[app.1]:   at require (module.js:375:17)
2013-06-17T06:08:53.023368+00:00 app[app.1]:   at Module._compile (module.js:446:26)
2013-06-17T06:08:53.023127+00:00 app[app.1]:   at Module.load (/app/node_modules/coffee-script/lib/coffee-script/coffee-script.js:211:35)
2013-06-17T06:08:53.023368+00:00 app[app.1]:   at Object.<anonymous> (/app/node_modules/hubot/bin/hubot:80:11, <js>:79:19)
2013-06-17T06:08:53.023754+00:00 app[app.1]:   at Object.<anonymous> (/app/node_modules/hubot/bin/hubot:104:3, <js>:105:19)
2013-06-17T06:08:53.023754+00:00 app[app.1]:   at Object.<anonymous> (/app/node_modules/hubot/bin/hubot:11:1, <js>:109:4)
2013-06-17T06:08:53.023127+00:00 app[app.1]:   at Module.require (module.js:359:17)
2013-06-17T06:08:53.023368+00:00 app[app.1]: 
2013-06-17T06:08:53.023754+00:00 app[app.1]:   at Module._compile (module.js:446:26)
2013-06-17T06:08:53.023368+00:00 app[app.1]:   at Object.module.exports.loadBot (/app/node_modules/hubot/index.coffee:11:7, <js>:21:12)
2013-06-17T06:08:53.023368+00:00 app[app.1]:   at Object.<anonymous> (/app/node_modules/hubot/bin/hubot:11:1, <js>:109:4)
2013-06-17T06:08:53.023368+00:00 app[app.1]:   at Robot.loadAdapter (/app/node_modules/hubot/src/robot.coffee:230:7, <js>:217:31)
2013-06-17T06:08:53.023754+00:00 app[app.1]: TypeError: Cannot call method 'on' of null
2013-06-17T06:08:53.023368+00:00 app[app.1]:   at new Robot (/app/node_modules/hubot/src/robot.coffee:36:5, <js>:46:14)
2013-06-17T06:08:53.023754+00:00 app[app.1]: 
2013-06-17T06:08:54.194289+00:00 heroku[app.1]: Process exited with status 1
2013-06-17T06:08:54.214754+00:00 heroku[app.1]: State changed from up to crashed

Package.xml

{
  "name": "hosted-hubot",
  "version": "2.3.2",
  "author": "GitHub Inc.",
  "keywords": "github hubot campfire bot",
  "description": "A simple helpful Robot for your Company",
  "licenses": [
    {
      "type": "MIT",
      "url": "http://github.com/github/hubot/raw/master/LICENSE"
    }
  ],
  "repository": {
    "type": "git",
    "url": "https://github.com/github/hubot.git"
  },
  "dependencies": {
    "hubot": "2.3.2",
    "hubot-scripts": ">= 2.1.0",
    "optparse": "1.0.3",
    "hubot-irc": "0.0.8",
    "coffee-script": ">=1.0.0"
  },
  "engines": {
    "node": "0.6.x",
    "npm": "1.0.x"
  }
}

split method

when starting i get an error and hubot terminates:

/opt/hubot# bin/hubot -a irc
[Fri, 30 Mar 2012 14:47:23 GMT] INFO Loading scripts from /opt/hubot/scripts
[Fri, 30 Mar 2012 14:47:23 GMT] INFO Loading scripts from /opt/hubot/src/scripts
TypeError: Cannot call method 'split' of undefined
    at IrcBot.run (/opt/hubot/node_modules/hubot-irc/src/irc.coffee:70:44)
    at Robot.run (/opt/hubot/node_modules/hubot/src/robot.coffee:290:27)
    at Object.<anonymous> (/opt/hubot/node_modules/hubot/bin/hubot:102:11)
    at Object.<anonymous> (/opt/hubot/node_modules/hubot/bin/hubot:105:4)
    at Module._compile (module.js:441:26)
    at Object.run (/opt/hubot/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/coffee-script.js:68:25)
    at /opt/hubot/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/command.js:135:29
    at /opt/hubot/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/command.js:110:18
    at [object Object].<anonymous> (fs.js:115:5)
    at [object Object].emit (events.js:64:17)

Add unit tests

It's getting a little unruly trying to make sure new PR's don't break anything without firing up the whole hubot and smoke testing.

I'm a fan of Mocha for unit testing and I'd like to start adding some unit tests for our methods.

I'm going to start off in another branch and hopefully have some reviews with other team members as the process goes on.

Hubot doesn't respond on IRC channel

I launched hubot 2.3.2.
Started without issue, however hubot doesn't respond on IRC channel:

HUBOT_IRC_SERVER="irc.freenode.net" HUBOT_IRC_NICK="hubot_test_2331" HUBOT_IRC_ROOMS="#hubot-irc" bin/hubot -a irc
23:50 -!- hubot_test_2331 [[email protected]] has joined #hubot-irc
23:50 < wojtek_w> hubot ping

I can see log message on my server, but no response on IRC channel:

From wojtek_w to #hubot-irc: hubot ping
#hubot-irc <wojtek_w> hubot ping

Cannot connect to SSL server

I have been unable to get hubot-irc to connect to a SSL IRC server. This includes both my company's SSL IRC server as well as Grove's SSL IRC server.

Configuration (with a few redactions)
HUBOT_IRC_NICK="botname"
HUBOT_IRC_REALNAME="bot real name"
HUBOT_IRC_PORT=6697
HUBOT_IRC_ROOMS="#ircroom"
HUBOT_IRC_SERVER="irc.example.com"
HUBOT_IRC_PASSWORD="password"
HUBOT_IRC_DEBUG="true"
HUBOT_IRC_USESSL="true"
HUBOT_IRC_USERNAME="botname"
HUBOT_IRC_SERVER_FAKE_SSL="true" # removing this changes nothing
HUBOT_IRC_SERVER_CERT_EXPIRED="true" # removing this changes nothing

Despite HUBOT_IRC_DEBUG="true", this is the output:

Connection got "close" event
Disconnected: reconnecting
Waiting 2000ms before retrying
Connection got "end" event

These four lines repeat indefinitely. I don't find this particularly helpful for debugging.

I have also replicated this with @jgable's hubot-irc-runnable. The same thing happens regardless of whether the bot is hosted on Heroku or being run locally. Also note that I have been able to get both hubot-irc and hubot-irc-runnable to connect to multiple non-SSL IRC servers.

I think I must be missing something but I haven't been able to figure it out. I would greatly appreciate any assistance.

hubot -a irc won't start

hubot version 2.3.4
hubot-irc version 0.1.4

bitnami@ip-10-160-178-43:/opt/hubot/GladOS$ node -v
v0.8.15

bitnami@ip-10-160-178-43:/opt/hubot/GladOS$ bin/hubot -a irc
[Fri Dec 07 2012 02:16:52 GMT+0000 (UTC)] ERROR Cannot load adapter irc - TypeError: Object # has no method 'robot'
TypeError: Object # has no method 'robot'
at Object. (/opt/hubot/GladOS/node_modules/hubot-irc/src/irc.coffee:7:28)
at Object. (/opt/hubot/GladOS/node_modules/hubot-irc/src/irc.coffee:160:4)
at Module._compile (module.js:449:26)
at Object.require.extensions..coffee (/opt/hubot/GladOS/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/coffee-script.js:22:21)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:362:17)
at require (module.js:378:17)
at Robot.loadAdapter (/opt/hubot/GladOS/node_modules/hubot/src/robot.coffee:215:31)
at new Robot (/opt/hubot/GladOS/node_modules/hubot/src/robot.coffee:47:14)
TypeError: Cannot call method 'on' of null
at Object. (/opt/hubot/GladOS/node_modules/hubot/bin/hubot:105:19)
at Object. (/opt/hubot/GladOS/node_modules/hubot/bin/hubot:109:4)
at Module._compile (module.js:449:26)
at Object.exports.run (/opt/hubot/GladOS/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/coffee-script.js:79:25)
at compileScript (/opt/hubot/GladOS/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/command.js:175:29)
at fs.stat.notSources.(anonymous function) (/opt/hubot/GladOS/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/command.js:150:18)
at fs.readFile (fs.js:176:14)
at Object.oncomplete (fs.js:297:15)

Hubot Works in CLI; Doesn't respond in IRC

My Hubot installation works perfectly in shell mode, but when I connect it to IRC, it doesn't respond to anything. I have seen many previous issues about this, but they have all been closed without definitive answers. I tried removing the Hubot dependency, but that created an error saying I needed that dependency. I've tried countless things I've found on various parts of the internet, but nothing seems to work.

Timeout after 20 minutes of inactivity

I seem to have timeout issues with hubot dies with a connection error if there's been no activity for 20 minutes. In case it makes a difference, I'm having hubot connect to Freenode.

2012-04-10T23:59:20+00:00 heroku[app.1]: State changed from starting to up
2012-04-10T23:59:20+00:00 app[app.1]: [Tue, 10 Apr 2012 23:59:20 GMT] INFO Loading scripts from /app/scripts
2012-04-10T23:59:20+00:00 app[app.1]: [Tue, 10 Apr 2012 23:59:20 GMT] INFO Loading scripts from /app/src/scripts
2012-04-10T23:59:20+00:00 app[app.1]: [Tue, 10 Apr 2012 23:59:20 GMT] INFO Loading hubot-scripts from /app/node_modules/hubot-scripts/src/scripts
2012-04-10T23:59:20+00:00 app[app.1]: [Tue, 10 Apr 2012 23:59:20 GMT] INFO Successfully connected to Redis
2012-04-10T23:59:21+00:00 app[app.1]: 10 Apr 23:59:21 - Sending irc NICK/USER
2012-04-10T23:59:33+00:00 app[app.1]: layfon has joined #thisisatest
2012-04-11T00:19:23+00:00 app[app.1]: 
2012-04-11T00:19:23+00:00 app[app.1]: node.js:134
2012-04-11T00:19:23+00:00 app[app.1]:         throw e; // process.nextTick error, or 'error' event on first tick
2012-04-11T00:19:23+00:00 app[app.1]:         ^
2012-04-11T00:19:23+00:00 app[app.1]: Error: ECONNREFUSED, Connection refused
2012-04-11T00:19:23+00:00 app[app.1]:     at Socket._onConnect (net.js:599:18)
2012-04-11T00:19:23+00:00 app[app.1]:     at IOWatcher.onWritable [as callback] (net.js:186:12)
2012-04-11T00:19:24+00:00 heroku[app.1]: Process exited with status 1
2012-04-11T00:19:24+00:00 heroku[app.1]: State changed from up to crashed

CERT_HAS_EXPIRED crash, even though HUBOT_IRC_SERVER_FAKE_SSL is set

I have followed all steps, but hubot with IRC won't work for me (on heroku or locally).

In both environments, I have set: HUBOT_IRC_SERVER_FAKE_SSL="true"

When I run hubot, here is the output:

$ ./bin/hubot -a irc
path.exists is now called `fs.exists`.
6 Nov 11:30:44 - CERT_HAS_EXPIRED
6 Nov 11:31:19 - Unhandled message: { command: 'ERROR',
  rawCommand: 'ERROR',
  commandType: 'normal',
  args: [ 'Closing Link: 67.17.159.46 (Registration timed out)' ] }
6 Nov 11:31:19 - Connection got "end" event
6 Nov 11:31:19 - Connection got "close" event
6 Nov 11:31:19 - Disconnected: reconnecting
6 Nov 11:31:19 - Waiting 2000ms before retrying
6 Nov 11:31:21 - CERT_HAS_EXPIRED

Any ideas?

Unable to join rooms on freenode

I just updated 2 hubot instances on heroku to 2.0.4. One connects to a http://grove.io server where everything works fine. However the freenode connected one doesn't join any channels. The NickServ Auth works fine, but the bot doesn't do anything after that.

I 'm not yet sure wether this is a generic problem or with my setup and I'll look further into it. I just wanted to open an issue to have it mentioned in case somebody else has this problem.

Excess Flood

When executing hubot help my bot always gets kicked out on freenode.

hubot left the room (quit: Excess Flood).

It maxes out the buffer because the responses come too quickly. Is there a way to throttle this?

Add documentation about how to develop/test

I am trying to make some modifications to the hubot-irc adapter and test them, but I am unsure how to deploy and use the changed script on Heroku. Normally I would specify hubot-irc in package.json, but that only works for versions available via npm. What's the setup do test your own hubot-irc adapter? Where do I have to place the code? Would be nice to get some info in the readme.

hubot-irc 0.1.0 fails

hubot-irc 0.1.0 fails with ERROR Cannot load adapter irc - TypeError: Cannot read property 'prototype' of undefined

my package.json:

"dependencies": {
  "hubot": "2.2.0",
  "hubot-irc": "0.1.x",
  "hubot-scripts": ">=2.0.8",
  "optparse": "1.0.3"
}

hubot completely quiet

hi,

I've tried this hubot-irc adapter, and the result is not very encouraging.
the bot connects to my localhost IRCd, joins the correct channel, etc.
unfortunately, it's completely quiet, silent, dumb.
I've tried to talk to it via /query or on the designated channel, and I've got no answer.
it correctly reads lines on the channel, but it doesn't react at all

I've tried to load several scripts using the hubot-scripts.json file, without a result. What am I doing wrong?

Sending a private message

Hi all,

Sorry for this rather simple question, but what's the correct command for sending a private message? I've got the following in my script, running on Freenode:

module.exports = (robot) ->
  robot.enter (response) ->
    user = response.message.user.name
    response.send "/msg #{user} If you're posting code samples, please put the source in a gist at https://gist.github.com/. Make sure you remove any secrets and access tokens."

However, my message is just appearing in plain text in the room. How can I actually make this private?

Receiving

Not sure why, but I've figured out that on receive, the base robot.receive does not see the incoming message as an instance of Robot.TextMessage. I added

if !(message instanceof Robot.TextMessage)
      message = new Robot.TextMessage(message.user, message.text)

To the robot.coffee, which fixed it, but obviously looks wrong. The code in the IRC module does create an instance of Robot.TextMessage, but maybe someone with more node / coffeescript experience has an idea?

Other than that, the module works great.

hubot crashed when starting with irc adapter

Hi,

I am trying to run hubot with the irc adapter on Ubuntu Linux. I am using hubot 2.0.5, and have added the line

"hubot-irc": ">= 0.0.1",

to package.json and have then installed the irc adapter by invoking "npm install". The following happens:

~/apps/hubot % bin/hubot -a irc

[Sat, 21 Jan 2012 18:35:25 GMT] INFO Loading adapter irc
[Sat, 21 Jan 2012 18:35:25 GMT] INFO Loading scripts from /home/ccount/apps/hubot/scripts
[Sat, 21 Jan 2012 18:35:25 GMT] INFO Loading scripts from /home/ccount/apps/hubot/src/scripts
TypeError: Cannot call method 'split' of undefined
  at IrcBot.run (/home/ccount/apps/hubot/node_modules/hubot-irc/src/irc.coffee:68:44)
  at Robot.run (/home/ccount/apps/hubot/node_modules/hubot/src/robot.coffee:225:27)
  at Object.<anonymous> (/home/ccount/apps/hubot/node_modules/hubot/bin/hubot:105:11)
  at Object.<anonymous> (/home/ccount/apps/hubot/node_modules/hubot/bin/hubot:108:4)
  at Module._compile (module.js:432:26)
  at Object.run (/home/ccount/apps/hubot/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/coffee-script.js:66:25)
  at /home/ccount/apps/hubot/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/command.js:147:29
  at /home/ccount/apps/hubot/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/command.js:115:19
  at [object Object].<anonymous> (fs.js:115:5)
  at [object Object].emit (events.js:64:17)

NickServ authorization doesn't work @ irc.mozilla.org

The response from the server is:

25 Oct 20:54:30 - Unhandled message: { prefix: 'gravel.mozilla.org',
  server: 'gravel.mozilla.org',
  command: 'rpl_luserunknown',
  rawCommand: '253',
  commandType: 'reply',
  args: [ 'minion', '2', 'unknown connection(s)' ] }
25 Oct 20:54:30 - MODE:username sets mode: +ix
25 Oct 20:54:31 - GOT NOTICE from "NickServ": "This nick is owned by someone else.  Please choose another."
25 Oct 20:54:31 - GOT NOTICE from "NickServ": "(If this is your nick, type /msg NickServ IDENTIFY password.)"

which doesn't get caught by the following statement:

if from is 'NickServ' and text.indexOf('identify') isnt -1

The username is registered, and a provided both password (HUBOT_IRC_NICKSERV_PASSWORD) and nick.

Avoid flood using gist

It would be nice, especially with commands like hubot help, to push the output into a gist and paste a link to that into the channel instead of flooding the channel with dozens of messages. Some sensible limit, like maybe anything 5 lines or more, would make a nice default option.

Accessing IrcBot from a script

Hi,

more of a question really, but how would I go about if I want to write a custom script and want to access the bot variable defined in the irc.coffee? Is that possible?

Update LICENSE file to MIT

Currently, the LICENSE contains placeholder information.

The license specified in the package.json is MIT. This should be consistent with the README.md footer and LICENSE file.

Hook up Travis-CI

Add a .travis.yml to prevent issues like #88 .

language: node_js
node_js:
  - "0.11"
  - "0.10"
git:
  submodules: false
before_script:
  - npm install -g grunt-cli

Update package.json to use grunt validate for test.

It doesn't obey instructions

00:48 anildigital: faunabot: the rules
00:48 anildigital: faunabot: hubot the rules
00:48 anildigital: faunabot: die
00:48 anildigital: faunabot die
00:48 anildigital: faunabot the rules

Doesn't work with hubot 2.4.7

I tried to use newest hubot, but it fails:

wojtek@ibm:~/Projects/hackerspace-hubot$ HUBOT_IRC_SERVER="irc.freenode.net" HUBOT_IRC_NICK="hubot_test_2331" HUBOT_IRC_ROOMS="#hubot-irc" bin/hubot -a irc
[Sat Mar 09 2013 23:36:03 GMT+0100 (CET)] ERROR Cannot load adapter irc - Error: Cannot find module 'hubot'
TypeError: Cannot call method 'on' of null
    at Object.<anonymous> (/home/wojtek/Projects/hackerspace-hubot/bin/hubot:136:19)
    at Object.<anonymous> (/home/wojtek/Projects/hackerspace-hubot/bin/hubot:140:4)
    at Module._compile (module.js:449:26)
    at Object.exports.run (/home/wojtek/.nvm/v0.8.22/lib/node_modules/coffee-script/lib/coffee-script/coffee-script.js:124:25)
    at compileScript (/home/wojtek/.nvm/v0.8.22/lib/node_modules/coffee-script/lib/coffee-script/command.js:166:29)
    at fs.stat.notSources.(anonymous function) (/home/wojtek/.nvm/v0.8.22/lib/node_modules/coffee-script/lib/coffee-script/command.js:141:18)
    at fs.readFile (fs.js:176:14)
    at Object.oncomplete (fs.js:297:15)
wojtek@ibm:~$ node -v
v0.8.22

Does it include NickServ functionality ?

In this http://oreilly.com/pub/h/1940, there are some commands,which are used in IRC client, actually call IRC buildin NickServ to ask server to work something out.

for example, /history #channel_name is the command in NickServ asking IRC server to show the user history. Does this adapter support such functionality which I could use NickServ Commands?

Enable flood protection by default

I'm working on a hubot for #hubot (very meta), and run into the issue of excess flooding. A quick googling pointed me in the right direction, but I think enabling this by default would be a good thing.

For values of HUBOT_IRC_UNFLOOD, I'm thinking:

  • null: enable by default
  • "true": enable
  • "false": disable
  • decimal: set a delay in seconds, to address #67

I'll try to put together a pull request to attach, but wanted to get this filed for anyone else searching or considering doing this.

Help needed with adapter

I can see pretty good pull requests and I just don't know much about coffee-script so if anybody want to help please let me know.

How to use HUBOT_IRC_UNFLOOD?

Hi,

My hubot irc bot gets killed automatically. I also saw Excess Flood message. How to fix it. Also it's running on Heroku.

Not compatible with hubot 2.5.1?

I see that the README.md states "You must use the downloaded and extracted version of the hubot code, not just a clone of the repo", and it links to a tar of 2.3.2. I've been successfully using this adapter with 2.4.8, but when I update to 2.5.1, hubot does not respond in IRC, but the command line interface still works.

I'm content using 2.4.8, but someone might want to try to reproduce this.

Any user call is failing with TypeError: Cannot read property 'user' of undefined

Here is one example:

#test <vachon> hubot: stagehand book 10
[Thu Jan 03 2013 16:02:04 GMT-0500 (EST)] ERROR Unable to call the listener: TypeError: Cannot read property 'user' of undefined
TypeError: Cannot read property 'user' of undefined
    at /opt/hubot/src/scripts/stagehand.coffee:5:13
    at TextListener.callback (/opt/hubot/src/scripts/stagehand.coffee:42:7)
    at TextListener.call (/opt/hubot/node_modules/hubot/src/listener.coffee:21:14)
    at Robot.receive (/opt/hubot/node_modules/hubot/src/robot.coffee:110:33)
    at IrcBot.receive (/opt/hubot/node_modules/hubot/src/adapter.coffee:39:25)
    at Client.<anonymous> (/opt/hubot/node_modules/hubot-irc/src/irc.coffee:205:21)
    at Client.emit (events.js:77:17)
    at Client.<anonymous> (/opt/hubot/node_modules/hubot-irc/node_modules/irc/lib/irc.js:384:22)
    at Client.emit (events.js:67:17)
    at /opt/hubot/node_modules/hubot-irc/node_modules/irc/lib/irc.js:545:22

Every script which calls for a user is getting this. Its like its not being parsed.

Here is my npm list

├─┬ [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ └── [email protected] 
├── [email protected]  extraneous
├─┬ [email protected]  extraneous
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ └── [email protected] 
├── [email protected]  extraneous
├─┬ [email protected] 
│ ├── [email protected] 
│ └─┬ [email protected] 
│   ├── [email protected] 
│   ├── [email protected] 
│   ├── [email protected] 
│   ├── [email protected] 
│   ├── [email protected] 
│   ├── [email protected] 
│   ├── [email protected] 
│   ├── [email protected] 
│   └── [email protected] 
├─┬ [email protected] 
│ └── [email protected] 
├── [email protected] 
├─┬ [email protected] 
│ ├─┬ [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ └─┬ [email protected] 
│   ├─┬ [email protected] 
│   │ ├── [email protected] 
│   │ └─┬ [email protected] 
│   │   └── [email protected] 
│   └── [email protected] 
├── [email protected]  extraneous
├─┬ [email protected] 
│ ├── [email protected] 
│ ├── [email protected] 
│ └─┬ [email protected] 
│   └── [email protected] 
├── [email protected] 
├─┬ [email protected]  extraneous
│ └── [email protected] 
└── [email protected]  extraneous

Hubot crashes when receiving a zero-length message over IRC

When a zero-length IRC message is sent to an channel that a hubot-IRC bot is present in, it crashes with the following backtrace:

2012-11-22T13:05:31.44778 
2012-11-22T13:05:31.44784 /opt/hubot/node_modules/hubot-irc/node_modules/irc/lib/irc.js:548
2012-11-22T13:05:31.44831                     throw err;
2012-11-22T13:05:31.44848                           ^
2012-11-22T13:05:31.45646 TypeError: Cannot read property '0' of undefined
2012-11-22T13:05:31.45653     at Client.<anonymous> (/opt/hubot/node_modules/hubot-irc/node_modules/irc/lib/irc.js:380:25)
2012-11-22T13:05:31.45654     at Client.emit (events.js:67:17)
2012-11-22T13:05:31.45655     at /opt/hubot/node_modules/hubot-irc/node_modules/irc/lib/irc.js:545:22
2012-11-22T13:05:31.45656     at Array.forEach (native)
2012-11-22T13:05:31.45656     at Socket.<anonymous> (/opt/hubot/node_modules/hubot-irc/node_modules/irc/lib/irc.js:542:15)
2012-11-22T13:05:31.45657     at Socket.emit (events.js:67:17)
2012-11-22T13:05:31.45657     at TCP.onread (net.js:362:31)

TypeError: Object #<IrcBot> has no method 'emit'

I get this when I try to start Hubot with the IRC adapter:

TypeError: Object #<IrcBot> has no method 'emit'
    at IrcBot.run (/Users/jimeh/Projects/layfon/node_modules/hubot-irc/src/irc.coffee:171:19)
    at Robot.run (/Users/jimeh/Projects/layfon/node_modules/hubot/src/robot.coffee:290:27)
    at Object.<anonymous> (/Users/jimeh/Projects/layfon/node_modules/hubot/bin/hubot:102:11)
    at Object.<anonymous> (/Users/jimeh/Projects/layfon/node_modules/hubot/bin/hubot:105:4)
    at Module._compile (module.js:441:26)
    at Object.run (/Users/jimeh/Projects/layfon/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/coffee-script.js:68:25)
    at /Users/jimeh/Projects/layfon/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/command.js:135:29
    at /Users/jimeh/Projects/layfon/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/command.js:110:18
    at [object Object].<anonymous> (fs.js:115:5)
    at [object Object].emit (events.js:64:17)

Here's the list of npm packages I'm using:

├─┬ [email protected] 
│ ├── [email protected] 
│ ├─┬ [email protected] 
│ │ ├── [email protected] 
│ │ ├── [email protected] 
│ │ └── [email protected] 
│ ├── [email protected] 
│ └── [email protected] 
├─┬ [email protected] 
│ └── [email protected] 
├─┬ [email protected] 
│ └── [email protected] 
└── [email protected]

crashes with hubot v2.3.0

seeing the following when deploying with 2.3.0, but works when I force 2.2.1 in package.json

Starting process with command `bin/hubot -a irc -n dr-hubot --alias "!"`
 bin/hubot: 3: npm: not found
     at Object.<anonymous> (/app/node_modules/hubot-irc/src/irc.coffee:7:28)
 TypeError: Object #<Object> has no method 'robot'
     at Object.<anonymous> (/app/node_modules/hubot-irc/src/irc.coffee:212:4)
     at Module._compile (module.js:446:26)
 [Wed Jul 18 2012 23:13:40 GMT+0000 (UTC)] ERROR Cannot load adapter irc - TypeError: Object #<Object> has no method 'robot'
     at Object..coffee (/app/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/coffee-script.js:22:21)
     at Function._load (module.js:311:12)
     at Module.load (module.js:353:31)
     at Robot.loadAdapter (/app/node_modules/hubot/src/robot.coffee:218:31)
     at Module.require (module.js:359:17)
     at new Robot (/app/node_modules/hubot/src/robot.coffee:49:14)
     at require (module.js:375:17)
     at Module._compile (module.js:446:26)
     at Object.<anonymous> (/app/node_modules/hubot/bin/hubot:105:19)
     at Object.run (/app/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/coffee-script.js:79:25)
     at /app/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/command.js:177:29
 TypeError: Cannot call method 'on' of null
     at Object.<anonymous> (/app/node_modules/hubot/bin/hubot:109:4)
     at /app/node_modules/hubot/node_modules/coffee-script/lib/coffee-script/command.js:152:18
     at [object Object].<anonymous> (fs.js:123:5)
     at Object.oncomplete (fs.js:1190:12)
     at [object Object].emit (events.js:64:17)
Process exited with status 1
State changed from starting to crashed

see reply from tombell:
hubotio/hubot#318

IRC Channel Password

I see the env var for irc_password but it looks like - "...the optional password of the IRC server.." instead of the channel.

Is there a channel password available?

Add simple setup directions to readme

It's hard for new comers to find simple / straight forward directions on how to get the latest hubot code up and running with the irc adaptor. We should add some directions to help with that.

User ID generation

I was looking at the code for the user ID generation as I noticed one of my users had an ID that was a digit shorter than the rest. It turns out that the time (milliseconds after 1969) is being divided by 1000 and turned into a string before having its decimal point ripped out. This obviously has the effect of cutting off some of the least significant trailing 0s.

Firstly, what is the point of this? Why not just use the number of milliseconds straight up? If the number of milliseconds doesn't end in a 0 then there is no difference between the method currently employed and just turning the number into a string without the divide. As it is, one in every 10 users has one less character in their ID, one in every 100 users has two less, and one in every 1000 users has three less (on average).

Secondly, this affects the length of time it takes for two users to potentially have an ID clash. Though extremely unlikely, what happens in these scenarios is that an existing user object is used for the new user, and the details within are changed over to the details of the new user (name and room). If the previous owner of the user object speaks again, they will get a new user object created. This means a possible loss of script-related data for the old user and the "inheritance" of this script-related data for the new user. Obviously a problem.

Without the divide by 1000 it'll take hundreds of thousands of years for the limit to be reached, meaning that there is no practical possibility of an ID clash. However, as things currently stand there could be a ID clash within 500 years! I don't know about you but I'm hoping I'll live that long with my IRC bot by my side, growing old together as I delegate more and more tasks to it.

But seriously, I just wanted to point out this line of code and ask why it is what it is. Perhaps I'll learn the reason for the divide by 1000, or perhaps you'll get rid of the divide entirely so that the line in question is as follows:

id = new Date().getTime().toString()

The other reason, if you didn't guess, is that it causes my robot.brain debug output to not line up nicely. As it stands, I'm more likely to kill myself over this alignment issue than reach the grand old age of 500.

IRC_NICK and robot.name are always the same.

We would like to have our robot named "marvin" and its IRC_NICK be "MarvinBot". However, it looks like in the irc.coffee (line 124) it is forcing the robot name to be the same as the IRC_NICK. Is there a way to turn this off?

No longer works on Heroku?

I am trying to run a hubot v2.1.4 instance with hubot-irc v0.0.6 on heroku - the exact same code runs fine (connecting to freenode) on a plain ubuntu system (node v0.6.x). However, when deployed to Heroku, the bot connects and joins the channel, but doesn't respond to any messages.

I don't know enough about the herkou / cedar stack to know what might be different. It claims to be running node 0.6.14.

Anyone able to do this successfully? Is it due to the switch in the Procfile to "web" from "app"?

Hubot crashes with korean on UTF-8 IRC server.

2011-12-15T14:32:13+00:00 heroku[app.1]: State changed from starting to up
2011-12-15T14:32:20+00:00 app[app.1]: SeMalBot has joined #minec
2011-12-15T14:32:22+00:00 app[app.1]: From undefined to #minec: ㅇㅇ히로빈.......    (if somebody chat in korean, then crush)
2011-12-15T14:32:22+00:00 app[app.1]: 
2011-12-15T14:32:22+00:00 app[app.1]: /app/node_modules/hubot-irc/node_modules/irc/lib/irc.js:520
2011-12-15T14:32:22+00:00 app[app.1]:                     throw err;
2011-12-15T14:32:22+00:00 app[app.1]:                     ^
2011-12-15T14:32:22+00:00 app[app.1]: TypeError: Cannot call method 'toLowerCase' of undefined
2011-12-15T14:32:22+00:00 app[app.1]:     at Robot.userForName (/app/node_modules/hubot/src/robot.coffee:190:24)
2011-12-15T14:32:22+00:00 app[app.1]:     at IrcBot.userForName (/app/node_modules/hubot/src/adapter.coffee:48:25)
2011-12-15T14:32:22+00:00 app[app.1]:     at Client.<anonymous> (/app/node_modules/hubot-irc/src/irc.coffee:108:21)
2011-12-15T14:32:22+00:00 app[app.1]:     at Client.emit (events.js:72:17)
2011-12-15T14:32:22+00:00 app[app.1]:     at Client.<anonymous> (/app/node_modules/hubot-irc/node_modules/irc/lib/irc.js:361:22)
2011-12-15T14:32:22+00:00 app[app.1]:     at Client.emit (events.js:64:17)
2011-12-15T14:32:22+00:00 app[app.1]:     at /app/node_modules/hubot-irc/node_modules/irc/lib/irc.js:517:22
2011-12-15T14:32:22+00:00 app[app.1]:     at Array.forEach (native)
2011-12-15T14:32:22+00:00 app[app.1]:     at Socket.<anonymous> (/app/node_modules/hubot-irc/node_modules/irc/lib/irc.js:514:15)
2011-12-15T14:32:22+00:00 app[app.1]:     at Socket.emit (events.js:64:17)
2011-12-15T14:32:24+00:00 heroku[app.1]: State changed from up to crashed
2011-12-15T14:32:24+00:00 heroku[app.1]: Process exited

Cannot find module 'hubot'

While using a new copy of Hubot (Hubot v2.0.0 & v2.0.1), I'm getting the error of

[Tue May 29 2012 15:32:08 GMT-0700 (PDT)] ERROR Cannot load adapter irc - Error: Cannot find module 'hubot' Error: Cannot find module 'hubot'

after cloning a new hubot, running npm install hubot-irc along with exporting the proper environment variables.

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.