Module: IIRC::ReplyTarget

Included in:
Bot
Defined in:
lib/iirc/modules/reply_target.rb

Instance Method Summary collapse

Instance Method Details

#reply_target(evt) ⇒ Object

The +reply_target+ of an event is the sender's nickname when we are the +target+. Otherwise, it returns the regular +target+.

It lets us reply to events without having to repeat the (me === target) ? sender.nick : target logic used to make sure we don't message ourselves when we receive a direct PRIVMSG, NOTICE, etc.



10
11
12
# File 'lib/iirc/modules/reply_target.rb', line 10

def reply_target(evt)
  (me === evt.target) ? evt.sender.nick : evt.target
end