Class: Lita::Handlers::Schedules
- Inherits:
-
Handler
- Object
- Handler
- Lita::Handlers::Schedules
- Defined in:
- lib/lita/handlers/schedules.rb
Instance Method Summary collapse
Instance Method Details
#init_scheduler(payload) ⇒ Object
11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 |
# File 'lib/lita/handlers/schedules.rb', line 11 def init_scheduler(payload) return unless config.room @scheduler = Rufus::Scheduler.new if should_sleep_at = config.should_sleep_at @scheduler.cron should_sleep_at do robot.trigger(:should_sleep, room: config.room) end end if should_wake_up_at = config.should_wake_up_at @scheduler.cron should_wake_up_at do robot.trigger(:should_wake_up, room: config.room) end end end |
#should_sleep(payload) ⇒ Object
30 31 32 33 |
# File 'lib/lita/handlers/schedules.rb', line 30 def should_sleep(payload) target = Source.new(room: payload[:room]) robot.(target, "ねな( ˘ω˘)") end |
#should_wake_up(payload) ⇒ Object
36 37 38 39 40 41 42 43 44 45 46 47 48 |
# File 'lib/lita/handlers/schedules.rb', line 36 def should_wake_up(payload) target = Source.new(room: payload[:room]) = [ '₍₍ (̨̡ ˘ω˘)̧̢ ₎₎', '( ⁰⊖⁰)', '( ˘ω˘)クソネミ', '(◉ω◉)', '₍₍ (̨̡ ‾᷄⌂‾᷅)̧̢ ₎₎', '起きた |ωΦ)', '٩( ˘ω˘ )و', ] robot.(target, .sample) end |