Skip to content

Instantly share code, notes, and snippets.

@june29
Last active August 29, 2015 14:22
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 june29/90d6e7efe42c3a46d8a1 to your computer and use it in GitHub Desktop.
Save june29/90d6e7efe42c3a46d8a1 to your computer and use it in GitHub Desktop.
Gem::Specification.new do |spec|
spec.name = "ruboty-omikuji"
spec.version = "0.0.2"
spec.authors = ["Jun OHWADA"]
spec.email = ["june29.jp@gmail.com"]
spec.summary = "Omikuji"
spec.files = ["ruboty-omikuji.rb"]
spec.require_path = "."
end
module Ruboty
module Handlers
class Omikuji < Base
on(
/omikuji/i,
name: "omikuji",
description: "Array#sample"
)
def omikuji(message)
prefix = ENV['OMIKUJI_PREFIX']
sampled = ENV['OMIKUJI_ITEMS'].split(',').sample
suffix = ENV['OMIKUJI_SUFFIX']
text = [prefix, sampled, suffix].compact.select { |e| e.length > 0 }.join(" ")
message.reply(text)
end
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment