Last active
August 29, 2015 14:15
-
-
Save r7kamura/529cab313a3bf792fcf9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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