From df2a0325e0b9097fb24a2206211dd375b29cfdb4 Mon Sep 17 00:00:00 2001 From: kmnk Date: Mon, 19 Mar 2012 02:01:38 +0900 Subject: [PATCH] append notice method to Adapter and Robot.Response --- src/irc.coffee | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/src/irc.coffee b/src/irc.coffee index 8a82054..ba15476 100644 --- a/src/irc.coffee +++ b/src/irc.coffee @@ -15,6 +15,17 @@ class IrcBot extends Adapter console.log "#{user.name} #{str}" @bot.say(user.name, str) + notice: (user, strings...) -> + for str in strings + if not str? + continue + if user.room + console.log "notice #{user.room} #{str}" + @bot.notice(user.room, str) + else + console.log "notice #{user.name} #{str}" + @bot.notice(user.name, str) + reply: (user, strings...) -> for str in strings @send user, "#{user.name}: #{str}" @@ -108,6 +119,15 @@ class IrcBot extends Adapter @bot = bot +class IrcResponse extends Robot.Response + notice: (strings...) -> + @robot.adapter.notice @message.user, strings... + exports.use = (robot) -> + robot.notice = (user, strings...) -> + @adapter.notice user, strings... + + robot.Response = IrcResponse + new IrcBot robot