Skip to content

Commit

Permalink
append notice method to Adapter and Robot.Response
Browse files Browse the repository at this point in the history
  • Loading branch information
kmnk committed Mar 18, 2012
1 parent a1ee96d commit df2a032
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/irc.coffee
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down Expand Up @@ -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

0 comments on commit df2a032

Please sign in to comment.