Skip to content

Instantly share code, notes, and snippets.

@KTamas
Forked from anonymous/gist:1016663
Created June 9, 2011 13:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KTamas/1016741 to your computer and use it in GitHub Desktop.
Save KTamas/1016741 to your computer and use it in GitHub Desktop.
irc = require 'irc'
navi = new irc.Client 'hub.irc.hu', 'Navi', debug:true, channels: ['#nonesuch']
Array::random = ->
@[Math.floor Math.random()*@length]
navi.hey = navi.addListener
navi.addListener 'message', (from, to, message) ->
if message.toUpperCase().match '^' + @nick.toUpperCase() + '(\:|\,)'
@emit 'listen', from, to, message
navi.hey 'listen', (from, to, message) ->
navi.say to, "Hey, listen!"
process.on "SIGINT", ->
navi.disconnect "Goodbye cruel world!"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment