class Ruboty::Actions::OpeningSentence

Constants

AOZORA_RANDOM_BOOK_URL

Public Instance Methods

call() click to toggle source
# File lib/ruboty/actions/opening_sentence.rb, line 10
def call
  json = open(AOZORA_RANDOM_BOOK_URL).read rescue return
  book = JSON.parse(json) rescue return
  message.reply [
    "@#{message.from_name}",
    "作品名: #{book['title']}",
    book['opening_sentence'],
    book['url']
  ].join($/)
end