]> 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 f66c4fc8a40b79b7f9da4974df1c9f13cf6afc01..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
@@ -175,7 +171,7 @@ class RemindPlugin < Plugin
   def remind(m, params)
     who = params.has_key?(:who) ? params[:who] : m.sourcenick
     string = params[:string].to_s
-    puts "in remind, string is: #{string}"
+    debug "in remind, string is: #{string}"
     if(string =~ /^(.*)\s+in\s+(.*)$/)
       subject = $1
       period = $2
@@ -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'