X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fremind.rb;h=c10186f5861fd32c67a0604872f369678bde5f0f;hb=fc0c682cbf7a68b8ccd458ac776770fccf9e59f4;hp=5ad980aeac8d33012da673e0c0594796d8100f32;hpb=21949774b91eaec6ecde4eaa8ad121e2c0a36b87;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/remind.rb b/data/rbot/plugins/remind.rb index 5ad980ae..c10186f5 100644 --- a/data/rbot/plugins/remind.rb +++ b/data/rbot/plugins/remind.rb @@ -1,6 +1,17 @@ -require 'rbot/utils' - class RemindPlugin < Plugin + # read a time in string format, turn it into "seconds from now". + # example formats handled are "5 minutes", "2 days", "five hours", + # "11:30", "15:45:11", "one day", etc. + # + # Throws:: RunTimeError "invalid time string" on parse failure + def timestr_offset(timestr) + Utils.parse_time_offset(timestr) + end + + class UnparsedPeriodError < RuntimeError ; end + class NegativePeriodError < RuntimeError ; end + class ShortRepeatError < RuntimeError ; end + def initialize super @reminders = Hash.new @@ -12,25 +23,25 @@ class RemindPlugin < Plugin } } @reminders.clear + super end def help(plugin, topic="") - if(plugin =~ /^remind\+$/) - "see remind. remind+ can be used to remind someone else of something, using instead of 'me'. However this will generally require a higher auth level than remind." - else - "remind me [about] in