]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blobdiff - data/rbot/plugins/cal.rb
plugin(points): new message parser, see #34
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / cal.rb
index 4f28310b60f640cd721eb0398302fb16e92eed98..c649084a14394df93cc2306b7f9df11bce0d22b1 100644 (file)
@@ -1,12 +1,21 @@
 class CalPlugin < Plugin
+  Config.register Config::StringValue.new('cal.path',
+     :default => 'cal',
+     :desc => _('Path to the cal program'))
+
   def help(plugin, topic="")
-    "cal [options] => show current calendar [unix cal options]"
+    "cal [month year] => show current calendar [optionally specify month and year]"
   end
+
+  def cal_path
+    @bot.config["cal.path"]
+  end
+
   def cal(m, params)
     if params.has_key?(:month)
-      m.reply Utils.safe_exec("cal", params[:month], params[:year])
+      m.reply Utils.safe_exec(cal_path, params[:month], params[:year])
     else
-      m.reply Utils.safe_exec("cal")
+      m.reply Utils.safe_exec(cal_path)
     end
   end
 end