class Descartes::Reminder
Public Instance Methods
execute(m, hour, min, msg)
click to toggle source
# File lib/descartes/modules/reminder.rb, line 22 def execute(m, hour, min, msg) time = Time.new(Time.now.year, Time.now.month, Time.now.day, hour, min, 0) if Time.now < time if @@active_threads.size < 10 @@active_threads << Thread.new { sleep (time - Time.now) ; m.reply "#{m.user.nick}: #{msg}" ; @@active_threads.pop } m.reply 'Will be done' else m.reply "Stop, please. It's not like I have an elephant memory" end else m.reply "You can't remind in the past. Not yet." end end