]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/remind.rb
Call 'super' method from #cleanup() in all plugins
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / remind.rb
index 8cc263b8d60b6decb401254a4331161043824ecb..0d6e9eccb88c8f1f9c4fa4a0bfd68bc7cd884f67 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",
@@ -114,6 +112,7 @@ class RemindPlugin < Plugin
       }
     }
     @reminders.clear
+    super
   end
   def help(plugin, topic="")
     "reminder plugin: remind <who> [about] <message> in <time>, remind <who> [about] <message> every <time>, remind <who> [about] <message> at <time>, remind <who> no more [about] <message>, remind <who> no more. Generally <who> should be 'me', but you can remind others (nick or channel) if you have remind_others auth"
@@ -138,14 +137,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,10 +212,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 [about] *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 [about] *string', :auth => 'remind_other'
+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'