Sha256: 2e308745f4fb29a59037eefe18a6813638e187ac2d1d60cb1e2e99cc8071f9ef

Contents?: true

Size: 519 Bytes

Versions: 3

Compression:

Stored size: 519 Bytes

Contents

require 'open-uri'

module Cinch
  module Plugins
    class Ip
      include Cinch::Plugin

      match /ip$/

      set :plugin_name, 'ip'
      set :help, <<EOT
returns the ip grabbed from an url
EOT

      def getip()
        ip = open(@bot.config.options['cogconf']['ip']['url']).read
        ip == "Error" ? nil : ip
      rescue OpenURI::HTTPError
        nil
      end

      def new(bot)
        @bot = bot
      end

      def execute(m)
        m.reply("Server ip is " + getip())
      end

    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
cogbot-0.1.14 plugins/ip.rb
cogbot-0.1.13 plugins/ip.rb
cogbot-0.1.12 plugins/ip.rb