Skip to content

Instantly share code, notes, and snippets.

@r7kamura
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save r7kamura/529cab313a3bf792fcf9 to your computer and use it in GitHub Desktop.
Save r7kamura/529cab313a3bf792fcf9 to your computer and use it in GitHub Desktop.
Gem::Specification.new do |spec|
spec.name = "ruboty-kokodeikku"
spec.version = "0.0.1"
spec.authors = ["Ryo Nakamura"]
spec.email = ["r7kamura@gmail.com"]
spec.summary = "Compose haiku from chat"
spec.files = ["ruboty-kokodeikku.rb"]
spec.require_path = "."
spec.add_runtime_dependency "ikku"
end
require "ikku"
module Ruboty
module Handlers
class Kokodeikku < Base
on(
//,
all: true,
description: "ここで一句",
name: "kokodeikku",
)
def kokodeikku(message)
if !message.body.start_with?("ここで一句 ") && (phrases = reviewer.find(message.body))
message.reply("ここで一句 #{phrases.map(&:join).join(' ')}")
end
end
private
def reviewer
@reviewer ||= Ikku::Reviewer.new
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment