]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/remind.rb
search plugin: gcalc command thanks to epitron
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / remind.rb
index ef9d4be75525b9eecafc9a675519b03bbacec9e1..6ce179c49a8694371f30bf1e28e322748da07de0 100644 (file)
@@ -1,5 +1,3 @@
-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",
@@ -138,14 +136,12 @@ class RemindPlugin < Plugin
 
     if(repeat)
       @reminders[who][subject] = @bot.timer.add(period) {
-        time = Time.now + period
-        tstr = time.strftime("%H:%M:%S")
+        tstr = (Time.now + period).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")
+        tstr = Time.now.strftime("%H:%M:%S")
         @bot.say who, "reminder (#{tstr}): #{subject}"
       }
     end
@@ -215,14 +211,13 @@ class RemindPlugin < Plugin
   end
 end
 plugin = RemindPlugin.new
+
+plugin.default_auth('other', false)
+
 plugin.map 'remind me no more', :action => 'no_more'
-plugin.map 'remind me no more about *string', :action => 'no_more'
-plugin.map 'remind me no more *string', :action => 'no_more'
-plugin.map 'remind me about *string'
-plugin.map 'remind me *string'
-plugin.map 'remind :who no more', :auth => 'remind_other', :action => 'no_more'
-plugin.map 'remind :who no more about *string', :auth => 'remind_other', :action => 'no_more'
-plugin.map 'remind :who no more *string', :auth => 'remind_other', :action => 'no_more'
-plugin.map 'remind :who about *string', :auth => 'remind_other'
-plugin.map 'remind :who *string', :auth => 'remind_other'
+plugin.map 'remind me no more [about] *string', :action => 'no_more'
+plugin.map 'remind me [about] *string'
+plugin.map 'remind :who no more', :auth_path => 'other', :action => 'no_more'
+plugin.map 'remind :who no more [about] *string', :auth_path => 'other', :action => 'no_more'
+plugin.map 'remind :who [about] *string', :auth_path => 'other'