22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# 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
|