Class: Ruboty::Chinachu::Actions::Schedule
- Inherits:
-
Base
- Object
- Actions::Base
- Base
- Ruboty::Chinachu::Actions::Schedule
show all
- Defined in:
- lib/ruboty/chinachu/actions/schedule.rb
Constant Summary
Constants inherited
from Base
Base::PROGRAM_FORMAT
Instance Method Summary
collapse
Methods inherited from Base
#chinachu, #chinachu_options
Instance Method Details
#list_broadcasting ⇒ Object
7
8
9
|
# File 'lib/ruboty/chinachu/actions/schedule.rb', line 7
def list_broadcasting
message.reply(broadcasting.map { |p| summary(p, PROGRAM_FORMAT) }.join("\n"), code: true)
end
|
#list_channels ⇒ Object
11
12
13
|
# File 'lib/ruboty/chinachu/actions/schedule.rb', line 11
def list_channels
message.reply(channels.join("\n"), code: true)
end
|
#list_schedule ⇒ Object
15
16
17
18
19
20
21
22
23
24
25
26
|
# File 'lib/ruboty/chinachu/actions/schedule.rb', line 15
def list_schedule
current = Time.now
after_twenty_four_hour = current + (60 * 60 * 24)
begin
programs = schedules.select do |program|
start_at = Time.at(program.start / 1000)
current < start_at && start_at < after_twenty_four_hour
end
message.reply(programs.map { |p| summary(p, PROGRAM_FORMAT) }.join("\n"), code: true)
rescue
end
end
|