Class: TickingAway::TimeInfo

Inherits:
Object
  • Object
show all
Includes:
Cinch::Plugin
Defined in:
lib/ticking_away/cinch/plugins/time_info.rb

Instance Method Summary collapse

Instance Method Details

#on_connectObject

Instantiate bot with JSON file storage when the bot connects to the IRC server. I’d like storage to be configurable through the Cinch configs eventually



54
55
56
57
# File 'lib/ticking_away/cinch/plugins/time_info.rb', line 54

def on_connect(*)
  @storage = TickingAway::JSONFileStorage.new
  @ta_bot = config[:time_api] ? TickingAway::Bot.new(storage: @storage, time_api: config[:time_api]) : TickingAway::Bot.new(storage: @storage)
end

#timeat(msg) ⇒ Object

Check time for the timezone provided against the provided time api by asking the TickingAway Bot



61
62
63
# File 'lib/ticking_away/cinch/plugins/time_info.rb', line 61

def timeat(msg)
  msg.reply @ta_bot.time_check(msg.params[1])
end

#timepopularity(msg) ⇒ Object

Return the statistic for the provided tz_info or prefix by asking the TickingAway Bot



67
68
69
# File 'lib/ticking_away/cinch/plugins/time_info.rb', line 67

def timepopularity(msg)
  msg.reply @ta_bot.stat_check(msg.params[1])
end