class Warn
Public Class Methods
Source
# File plugins/warn.rb, line 33 def self.lookup(location = nil, fetch: RabbotHttp.method(:fetch), probe: Bom.method(:default_probe)) state = resolve_state(location, probe: probe) BomWarnings.lookup(state: state, fetch: fetch) end
Source
# File plugins/warn.rb, line 21 def self.resolve_state(location, probe: Bom.method(:default_probe)) text = location.to_s.strip return nil if text.empty? if text.match?(/\A(?:qld|nsw|vic|wa|sa|tas|act|nt)\z/i) return text.downcase end place = Bom.resolve_place(text, probe: probe) place ? place[:state] : text end
Source
# File plugins/warn.rb, line 17 def self.usage_message "Usage: !warn [state|location] — e.g. !warn qld, !warn townsville" end
Public Instance Methods
Source
# File plugins/warn.rb, line 38 def execute(m, location = nil) flood_safe_reply(m, self.class.lookup(location)) end