From 3629cc0bfd4ccb6c309d30021be8a4011f551ca9 Mon Sep 17 00:00:00 2001 From: Giuseppe Bilotta Date: Fri, 27 Jun 2008 19:03:03 +0200 Subject: figlet plugin: make it more friendly to external usage --- data/rbot/plugins/figlet.rb | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/data/rbot/plugins/figlet.rb b/data/rbot/plugins/figlet.rb index d95b0c58..7a3d1935 100644 --- a/data/rbot/plugins/figlet.rb +++ b/data/rbot/plugins/figlet.rb @@ -54,6 +54,8 @@ class FigletPlugin < Plugin @bot.config['toilet.filters'] end + attr_reader :has, :params + def test_figlet #check that figlet is present @has[:figlet] = File.exist?(figlet_path) @@ -102,7 +104,7 @@ class FigletPlugin < Plugin end def figlet(m, params) - key = m.plugin.intern + key = params[:plugin] || m.plugin.intern unless @has[key] m.reply("%{cmd} couldn't be found. if it's installed, you should set the %{cmd}.path config key to its path" % { :cmd => key @@ -117,7 +119,7 @@ class FigletPlugin < Plugin end # collect the parameters to pass to safe_exec - exec_params = [send(:"#{m.plugin}_path")] + @params[key] + [message] + exec_params = [send(:"#{key}_path")] + @params[key] + [message] # run the program m.reply Utils.safe_exec(*exec_params), :max_lines => 0 -- cgit v1.2.3