Sha256: 7645074109d9b84fdcd22c2e2c55ca56ead83718fc0797758d2224b6d9e53f63
Contents?: true
Size: 815 Bytes
Versions: 3
Compression:
Stored size: 815 Bytes
Contents
module Ruboty module Actions class Ragoon < ::Ruboty::Actions::Base def call target_date = parse_date(message[:date]) events = ::Ruboty::Ragoon::Event.new(target_date) message.reply(events.render(private: check_private(message))) end private def check_private(message) owner = message.original[:robot].send(:adapter).send(:user_info, ENV['SLACK_OWNER_ID']) message.from.start_with?('D') && owner['name'] == message.from_name end def parse_date(date) case date.downcase when 'today' Date.today when 'tomorrow' Date.today + 1 when 'yesterday' Date.today - 1 else Date.parse(date) end rescue Date.today end end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
ruboty-ragoon-0.2.1 | lib/ruboty/actions/ragoon.rb |
ruboty-ragoon-0.2.0 | lib/ruboty/actions/ragoon.rb |
ruboty-ragoon-0.1.2 | lib/ruboty/actions/ragoon.rb |