Class: Lita::Handlers::Inspirebot

Inherits:
Handler
  • Object
show all
Defined in:
lib/lita/handlers/inspirebot.rb

Instance Method Summary collapse

Instance Method Details

#authors(response) ⇒ Object



93
94
95
96
97
# File 'lib/lita/handlers/inspirebot.rb', line 93

def authors(response)
  @quotes = ::Inspirebot::Quotes.new
  authors = @quotes.authors_string.upcase
  response.reply "I know about the following authors: #{authors}. To hear quotes, type QUOTE {AUTHOR}"
end


110
111
112
113
# File 'lib/lita/handlers/inspirebot.rb', line 110

def menu(response)
  help = 'use QUOTE AUTHORS to get a list of authors. use QUOTE {AUTHOR} to get a random quote from the author'
  response.reply @quotes.get_quote(help)
end

#quote(response) ⇒ Object



99
100
101
102
103
104
105
106
107
108
# File 'lib/lita/handlers/inspirebot.rb', line 99

def quote(response)
  @quotes = ::Inspirebot::Quotes.new
  author = response.match_data[1].downcase
  if author.downcase == 'authors'
    authors = @quotes.authors_string.upcase
    response.reply "I know about the following authors: #{authors}. To hear quotes, type QUOTE {AUTHOR}"
  else
    response.reply @quotes.get_quote(author)
  end
end