# File rbot/plugins/remind.rb, line 23 def add_reminder(who, subject, timestr, repeat=false) begin period = Irc::Utils.timestr_offset(timestr) rescue RuntimeError return "couldn't parse that time string (#{timestr}) :(" end if(period <= 0) return "that time is in the past! (#{timestr})" end if(period < 30 && repeat) return "repeats of less than 30 seconds are forbidden" end if(!@reminders.has_key?(who)) @reminders[who] = Hash.new elsif(@reminders[who].has_key?(subject)) del_reminder(who, subject) end if(repeat) @reminders[who][subject] = @bot.timer.add(period) { time = Time.now + period tstr = time.strftime("%H:%M:%S") @bot.say who, "repeat reminder (next at #{tstr}): #{subject}" } else @reminders[who][subject] = @bot.timer.add_once(period) { time = Time.now + period tstr = time.strftime("%H:%M:%S") @bot.say who, "reminder (#{tstr}): #{subject}" } end return false end