module Lobstersbot::Tell

Public Instance Methods

on_tell(memory, channel, nick, message) click to toggle source
# 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) click to toggle source
# 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