]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/commitdiff
time: support POSIX time
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 27 Sep 2010 10:38:59 +0000 (12:38 +0200)
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>
Mon, 27 Sep 2010 10:38:59 +0000 (12:38 +0200)
data/rbot/plugins/time.rb

index 854e403de9fa3ab7570abe8bb30ea4daa63cb169..efea466f1d2012548372a42fb104b16478559d8c 100644 (file)
@@ -159,8 +159,12 @@ class TimePlugin < Plugin
       offset = (time - now).abs
       raise if offset < 0.1
     rescue => e
       offset = (time - now).abs
       raise if offset < 0.1
     rescue => e
-      m.reply _("unintelligible time")
-      return
+      if str.match(/^\d+$/)
+        time = Time.at(str.to_i)
+      else
+        m.reply _("unintelligible time")
+        return
+      end
     end
 
     if zone = @registry[m.sourcenick]
     end
 
     if zone = @registry[m.sourcenick]