Method: Cinch::Target#send
- Defined in:
- lib/cinch/target.rb
#send(text, notice = false) ⇒ void
Note:
The aliases msg and privmsg are deprecated and will be removed in a future version.
This method returns an undefined value.
Sends a PRIVMSG to the target.
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 |
# File 'lib/cinch/target.rb', line 34 def send(text, notice = false) # TODO deprecate `notice` argument, put splitting into own # method text = text.to_s split_start = @bot.config. || "" split_end = @bot.config. || "" command = notice ? "NOTICE" : "PRIVMSG" prefix = ":#{@bot.mask} #{command} #{@name} :" text.lines.map(&:chomp).each do |line| splitted = (line, prefix, split_start, split_end) splitted[0, (@bot.config. || splitted.size)].each do |string| @bot.irc.send("#{command} #{@name} :#{string}") end end end |