Module: Lobstersbot::Tell

Defined in:
lib/lobstersbot/plugins/tell.rb

Instance Method Summary collapse

Instance Method Details

#on_tell(memory, channel, nick, message) ⇒ Object



3
4
5
6
7
8
9
10
11
12
# File 'lib/lobstersbot/plugins/tell.rb', line 3

def on_tell(memory, channel, nick, message)
  parsed = message.match(/(?<target>[^\s]+)\s(?<message>.+)/)
  return unless parsed

  target = parsed[:target]
  memory[target] ||= []
  memory[target] << "#{nick}: #{parsed[:message]}"

  respond(channel, nick, "I'll pass that along when #{target} is around.")
end

#seen_tell(memory, nick, response) ⇒ Object



14
15
16
17
# File 'lib/lobstersbot/plugins/tell.rb', line 14

def seen_tell(memory, nick, response)
  return unless memory[nick].is_a? Array
  memory[nick].each {|msg| response.call(msg) }
end