class Sun
Public Class Methods
Source
# File plugins/sun.rb, line 21 def self.report(place, search: Geocoder.method(:search), fetch_json: RabbotHttp.method(:fetch_json)) text = place.to_s.strip return usage_message if text.empty? place_result = GeoLookup.lookup_place(text, search: search) return "Could not find #{text}" unless place_result coords = GeoLookup.coordinates_for(place_result) return "Could not find coordinates for #{text}" unless coords SunTimes.report_for_coords(coords[0], coords[1], place: text, fetch_json: fetch_json) end
Source
# File plugins/sun.rb, line 17 def self.usage_message "Usage: !sun <place> — e.g. !sun townsville" end
Public Instance Methods
Source
# File plugins/sun.rb, line 34 def execute(m, place) flood_safe_reply(m, self.class.report(place)) end