X-Git-Url: https://git.netwichtig.de/gitweb/?a=blobdiff_plain;f=data%2Frbot%2Fplugins%2Fremind.rb;h=6ce179c49a8694371f30bf1e28e322748da07de0;hb=b40ac172a32b71f1edc4e8b5992a4844e8eb6678;hp=f66c4fc8a40b79b7f9da4974df1c9f13cf6afc01;hpb=676dd61e6b0bea5f506d064039a685944aefd6fb;p=user%2Fhenk%2Fcode%2Fruby%2Frbot.git diff --git a/data/rbot/plugins/remind.rb b/data/rbot/plugins/remind.rb index f66c4fc8..6ce179c4 100644 --- a/data/rbot/plugins/remind.rb +++ b/data/rbot/plugins/remind.rb @@ -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'