Class: Ruboty::Handlers::Kokodeikku

Inherits:
Base
  • Object
show all
Defined in:
lib/ruboty/handlers/kokodeikku.rb

Constant Summary collapse

DEFAULT_PREFIX =
"ここで一句"

Instance Method Summary collapse

Instance Method Details

#kokodeikku(message) ⇒ Object



21
22
23
24
25
26
27
# File 'lib/ruboty/handlers/kokodeikku.rb', line 21

def kokodeikku(message)
  return if channels && !channels.include?(message.to)

  if message.from != robot.name && !message.body.start_with?("#{prefix} ") && (song = reviewer.find(message.body))
    message.reply("#{prefix} #{song.phrases.map(&:join).join(' ')}")
  end
end