]> git.netwichtig.de Git - user/henk/code/ruby/rbot.git/blob - data/rbot/plugins/cal.rb
plugin(hangman): fixes word generator closes #9
[user/henk/code/ruby/rbot.git] / data / rbot / plugins / cal.rb
1 class CalPlugin < Plugin
2   Config.register Config::StringValue.new('cal.path',
3      :default => 'cal',
4      :desc => _('Path to the cal program'))
5
6   def help(plugin, topic="")
7     "cal [month year] => show current calendar [optionally specify month and year]"
8   end
9
10   def cal_path
11     @bot.config["cal.path"]
12   end
13
14   def cal(m, params)
15     if params.has_key?(:month)
16       m.reply Utils.safe_exec(cal_path, params[:month], params[:year])
17     else
18       m.reply Utils.safe_exec(cal_path)
19     end
20   end
21 end
22 plugin = CalPlugin.new
23 plugin.map 'cal :month :year', :requirements => {:month => /^\d+$/, :year => /^\d+$/}
24 plugin.map 'cal'