Method: IRC::Object::Message#reply

Defined in:
lib/syndi/irc/object/message.rb

#reply(msg, in_channel) ⇒ Object

TODO:

Unfinished.

Note:

Essentially reply() exists to simplify the API. Rather than necessitating that commands use endless, illegible conditional nests to determine what to do, reply() is available so the API will just use some common sense to do it for them.

Reply to this message.

Examples:

msg.reply("The bar is of foo, indeed.", true)

Parameters:

  • msg (String)

    The message with which to reply.

  • in_channel (true, false)

    If the response should be in-channel (assuming it was received in a channel), specify +true+. If it should be private regardless of where it was received, specify +false+.

Since:

  • 4.0.0



72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/syndi/irc/object/message.rb', line 72

def reply(msg, in_channel)
  
  case [@channel.nil, in_channel, @nature]
  
  # Respond in-channel if this was sent to a channel *and* in_channel
  # is specified as true.
  when false, true, :msg
    irc.msg(@channel, msg)

  # Likewise for channel notices. 
  when false, true, :notice
    
  end

end