class Plugins::Fml

Public Instance Methods

execute(m) click to toggle source
# File lib/Zeta/plugins/fml.rb, line 18
def execute(m)
  m.reply fetch_random_fml, true
end

Private Instance Methods

fetch_random_fml() click to toggle source
# File lib/Zeta/plugins/fml.rb, line 23
def fetch_random_fml
  url = 'http://www.fmylife.com/random'

  html_body = RestClient.get(url).body

  fml_story = Nokogiri.HTML(html_body).at('article').text.strip
  fml_story[/^Today, (.+) FML/]
rescue => e
  e.message
end