Sha256: 9fa46416b427b14dcd50cff753cf01fcff6f94d5087da8bbb86d9b394b9afcbc

Contents?: true

Size: 746 Bytes

Versions: 39

Compression:

Stored size: 746 Bytes

Contents

# This plugin is brought to you by aburdette/cinch-fmylife
# Thank You!

module Plugins
  class Fml
    include Cinch::Plugin
    include Cinch::Helpers

    enable_acl(:nobody)

    set(
        plugin_name: "FuckMyLife",
        help: "Get a random FML.\nUsage: `?fml`",
    )

    match /fml/

    def execute(m)
      m.reply fetch_random_fml, true
    end

    private
    def fetch_random_fml
      url = 'http://www.fmylife.com/random'
      # fml_story = Nokogiri.HTML(RestClient.get(url)).at('div.article').text.strip
      fml_story = Nokogiri.HTML(open(url).read).at('div.article').text.strip
      fml_story[/^Today, (.+) FML/]
    rescue => e
      e.message
    end
  end
end

# AutoLoad
Bot.config.plugins.plugins.push Plugins::Fml

Version data entries

39 entries across 39 versions & 1 rubygems

Version Path
zetabot-2.0.8 lib/Zeta/plugins/fml.rb
zetabot-2.0.7 lib/Zeta/plugins/fml.rb
zetabot-2.0.6 lib/Zeta/plugins/fml.rb
zetabot-2.0.5 lib/Zeta/plugins/fml.rb
zetabot-2.0.4 lib/Zeta/plugins/fml.rb
zetabot-2.0.3 lib/Zeta/plugins/fml.rb
zetabot-2.0.2 lib/Zeta/plugins/fml.rb
zetabot-2.0.1 lib/Zeta/plugins/fml.rb
zetabot-2.0.0 lib/Zeta/plugins/fml.rb
zetabot-1.1.0 lib/Zeta/plugins/fml.rb
zetabot-1.0.7 lib/Zeta/plugins/fml.rb
zetabot-1.0.6 lib/Zeta/plugins/fml.rb
zetabot-1.0.5 lib/Zeta/plugins/fml.rb
zetabot-1.0.4 lib/Zeta/plugins/fml.rb
zetabot-1.0.3 lib/Zeta/plugins/fml.rb
zetabot-1.0.2 lib/Zeta/plugins/fml.rb
zetabot-1.0.1 lib/Zeta/plugins/fml.rb
zetabot-1.0.0 lib/Zeta/plugins/fml.rb
zetabot-0.0.22 lib/Zeta/plugins/fml.rb
zetabot-0.0.21 lib/Zeta/plugins/fml.rb