Skip to content

Commit

Permalink
Updating to work with latest hubot.
Browse files Browse the repository at this point in the history
  • Loading branch information
elliotttf committed Jun 25, 2012
1 parent 4b39ced commit a54b89d
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions src/irc.coffee
Original file line number Diff line number Diff line change
@@ -1,17 +1,10 @@
Robot = require('hubot').robot()
Adapter = require('hubot').adapter()
Robot = require('hubot').Robot
Adapter = require('hubot').Adapter
TextMessage = require('hubot').TextMessage

Irc = require 'irc'

class IrcBot extends Adapter
constructor: (@robot) ->
super @robot

@robot.notice = (user, strings...) ->
@adapter.notice user, strings...

@robot.Response = IrcResponse

send: (user, strings...) ->
for str in strings
if not str?
Expand Down Expand Up @@ -48,6 +41,12 @@ class IrcBot extends Adapter
@bot.part channel, () ->
console.log('left %s', channel)

kick: (channel, client, message) ->
@bot.emit 'raw',
command: 'KICK'
nick: process.env.HUBOT_IRC_NICK
args: [ channel, client, message ]

command: (command, strings...) ->
@bot.send command, strings...

Expand Down Expand Up @@ -110,7 +109,7 @@ class IrcBot extends Adapter
user.room = null
console.log "msg <#{from}> #{message}"

self.receive new Robot.TextMessage(user, message)
self.receive new TextMessage(user, message)

bot.addListener 'error', (message) ->
console.error('ERROR: %s: %s', message.command, message.args.join(' '))
Expand All @@ -135,7 +134,7 @@ class IrcBot extends Adapter

self.emit "connected"

class IrcResponse extends Robot.Response
class IrcResponse extends Response
notice: (strings...) ->
@robot.adapter.notice @message.user, strings...

Expand Down

0 comments on commit a54b89d

Please sign in to comment.