Skip to content

Instantly share code, notes, and snippets.

@stevenleeg
Forked from clehner/bong.coffee
Created July 31, 2013 18:38
Show Gist options
  • Save stevenleeg/6124832 to your computer and use it in GitHub Desktop.
Save stevenleeg/6124832 to your computer and use it in GitHub Desktop.
#!/usr/bin/env coffee
# install dependencies: npm install irc
irc = require 'irc'
server = 'hubbard.freenode.net'
nickServPassword = ''
nick = 'bongbot'
client = new irc.Client server, 'bongbot',
server: server
secure: true
port: 6697
channels: ['#hackny']
userName: 'bongbot'
realName: 'BongBot'
client.on 'connect', ->
console.log "connected to #{server}"
if nickServPassword
console.log 'identifying to NickServ'
client.say 'NickServ', 'identify ' + nickServPassword
client.on 'action', (from, channel, message) ->
if message.indexOf(nick) + nick.length == message.length
client.say channel, 'BOOOONNNGGGGGG'
client.on 'message', (from, channel, message) ->
if -1 !== message.indexOf nick
client.say channel, 'BONG'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment