Sha256: 0fce7eb8ce00caf09ae95d9d9ff078a3a0a477a1e62400517f8b7394b91f7010

Contents?: true

Size: 538 Bytes

Versions: 16

Compression:

Stored size: 538 Bytes

Contents

require "fortune_gem"

module Cinch
  module Plugins
    class Fortune
      include Cinch::Plugin

      match /f$/

      set :plugin_name, 'fortune'
      set :help, <<EOT
.f gives you a bit of random wisdom.
EOT

      def new(bot)
        @bot = bot
      end

      def fortune
        max_length = 256
        fortune = FortuneGem.give_fortune(:max_length => max_length)
        fortune.gsub(/[\n]/, "").gsub(/[\t]/, " ").gsub("?A:", "? A:")
      end

      def execute(m)
        m.reply(fortune)
      end

    end
    end
end

Version data entries

16 entries across 16 versions & 1 rubygems

Version Path
cogbot-0.1.14 plugins/fortune.rb
cogbot-0.1.13 plugins/fortune.rb
cogbot-0.1.12 plugins/fortune.rb
cogbot-0.1.11 plugins/fortune.rb
cogbot-0.1.10 plugins/fortune.rb
cogbot-0.1.9 plugins/fortune.rb
cogbot-0.1.7 plugins/fortune.rb
cogbot-0.1.6 plugins/fortune.rb
cogbot-0.1.5 plugins/fortune.rb
cogbot-0.1.4 plugins/fortune.rb
cogbot-0.1.3 plugins/fortune.rb
cogbot-0.1.2 plugins/fortune.rb
cogbot-0.1.1 plugins/fortune.rb
cogbot-0.1.0 plugins/fortune.rb
cogbot-0.0.3 plugins/fortune.rb
cogbot-0.0.2 plugins/fortune.rb