diff options
author | Yaohan Chen <yaohan.chen@gmail.com> | 2007-08-17 16:59:23 +0000 |
---|---|---|
committer | Yaohan Chen <yaohan.chen@gmail.com> | 2007-08-17 16:59:23 +0000 |
commit | ec408b8b010a0767f5d3b640f28fb840a66a1e72 (patch) | |
tree | fe5c7c2fc9e2239b107d215aa89e1201ec0db970 /data | |
parent | 3b0979270bd28f1d7bcae81c7065cdc8e5867d96 (diff) |
+ figlet.rb: added figlet.path to make path of the figlet program configurable
Diffstat (limited to 'data')
-rw-r--r-- | data/rbot/plugins/figlet.rb | 13 |
1 files changed, 10 insertions, 3 deletions
diff --git a/data/rbot/plugins/figlet.rb b/data/rbot/plugins/figlet.rb index b8561f47..b84a8521 100644 --- a/data/rbot/plugins/figlet.rb +++ b/data/rbot/plugins/figlet.rb @@ -2,15 +2,18 @@ class FigletPlugin < Plugin DEFAULT_FONTS = ['rectangles', 'smslant'] MAX_WIDTH=68 + BotConfig.register BotConfigStringValue.new('figlet.path', + :default => '/usr/bin/figlet', + :desc => _('Path to the figlet program')) + def initialize super - @figlet_path = "/usr/bin/figlet" # check that figlet actually has the font installed @figlet_font = nil for fontname in DEFAULT_FONTS # check if figlet can render this font properly - if system("#{@figlet_path} -f #{fontname} test test test") + if system("#{figlet_path} -f #{fontname} test test test") @figlet_font = fontname break end @@ -24,6 +27,10 @@ class FigletPlugin < Plugin end + def figlet_path + @bot.config['figlet.path'] + end + def help(plugin, topic="") "figlet <message> => print using figlet" end @@ -36,7 +43,7 @@ class FigletPlugin < Plugin end # collect the parameters to pass to safe_exec - exec_params = [@figlet_path] + @figlet_params + [message] + exec_params = [figlet_path] + @figlet_params + [message] # run figlet m.reply Utils.safe_exec(*exec_params) |