Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Fetching contributors…

Cannot retrieve contributors at this time

executable file 42 lines (35 sloc) 0.722 kb
require 'dialogue_extension'
require 'quote_of_the_day'
class QuoteDialogue < DialogueExtension
initial_state :quote
hook_words 'quote of the day', 'quote'
state :quote, {
['random','next','last','repeat'] => :quote
}
def initialize
@quoter = QuoteOfTheDay.new
# reset
end
def find_quotes
@last_search = Time.now
puts 'finding quotes'
@quoter.find
@quoter.random
end
def exit_quote(phrase)
case phrase
when 'random'
@quoter.random
when 'next'
@quoter.next
when 'last'
@quoter.last
end
end
def enter_quote
if @last_search.nil? or Time.now - @last_search > 600
find_quotes
end
@quoter.read
end
end
Jump to Line
Something went wrong with that request. Please try again.