Sha256: 5c41dd90592d5d8945ecf282160a1544d5fa7589b6e50f40376d251bec622367
Contents?: true
Size: 1.66 KB
Versions: 5
Compression:
Stored size: 1.66 KB
Contents
require 'ostruct' require 'persist' require 'open-uri' require 'json' require 'unitwise' module Plugins # Forecast is a Cinch plugin for getting the weather forecast. # @original_author Jonah Ruiz <jonah@pixelhipsters.com> # @author Liothen <liothen@flagrun.net> class WeatherHurricane include Cinch::Plugin include Cinch::Helpers enable_acl set( plugin_name: "Hurricane Info", help: "Get the Weather?.\nUsage: `?hurricane`\n", ) match /hurricane/, method: :hurricane def hurricane(msg) url = URI.encode "http://api.wunderground.com/api/#{Zsec.wunderground}/currenthurricane/view.json" location = JSON.parse( # RestClient.get(url) open(url).read ) return msg.reply "No results found for #{query}." if location.nil? reply_msg = "∴ #{location['currenthurricane'][0]['stormInfo']['stormName_Nice']} " \ "(#{location['currenthurricane'][0]['stormInfo']['stormNumber']}) "\ "≈ Category #{location['currenthurricane'][0]['Current']['SaffirSimpsonCategory']} " \ "≈ Wind #{location['currenthurricane'][0]['Current']['WindSpeed']['Mph']} mph " \ "(#{location['currenthurricane'][0]['Current']['WindSpeed']['Kph']} kph) " \ "≈ Wind Gust #{location['currenthurricane'][0]['Current']['WindGust']['Mph']} mph " \ "(#{location['currenthurricane'][0]['Current']['WindGust']['Kph']} kph) " \ "≈ #{location['currenthurricane'][0]['Current']['Time']['pretty']} ∴" msg.reply(reply_msg) end end end Bot.config.plugins.plugins.push Plugins::WeatherHurricane
Version data entries
5 entries across 5 versions & 1 rubygems