From a54b89d8589be616e8498404713c77549836bc0d Mon Sep 17 00:00:00 2001 From: Elliott Foster Date: Mon, 25 Jun 2012 13:48:05 -0500 Subject: [PATCH] Updating to work with latest hubot. --- src/irc.coffee | 23 +++++++++++------------ 1 file changed, 11 insertions(+), 12 deletions(-) diff --git a/src/irc.coffee b/src/irc.coffee index 6f58163..8958e74 100644 --- a/src/irc.coffee +++ b/src/irc.coffee @@ -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? @@ -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... @@ -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(' ')) @@ -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...