Method: Cinch::Message#reply

Defined in:
lib/cinch/message.rb

#reply(text, prefix = false)

This method returns an undefined value.

Replies to a message, automatically determining if it was a channel or a private message.

If the message is a STATUSMSG, i.e. it was send to +#channel or @#channel instead of #channel, the reply will be sent as the same kind of STATUSMSG. See #statusmsg_mode for more information on STATUSMSG.

Parameters:

  • text (String)

    the message

  • prefix (Boolean) (defaults to: false)

    if prefix is true and the message was in a channel, the reply will be prefixed by the nickname of whoever send the mesage



189
190
191
192
193
194
195
196
# File 'lib/cinch/message.rb', line 189

def reply(text, prefix = false)
  text = text.to_s
  if @channel && prefix
    text = text.split("\n").map {|l| "#{user.nick}: #{l}"}.join("\n")
  end

  reply_target.send(text)
end