summaryrefslogtreecommitdiff
path: root/data/rbot/plugins
diff options
context:
space:
mode:
authorGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-06-27 19:03:03 +0200
committerGiuseppe Bilotta <giuseppe.bilotta@gmail.com>2008-06-27 19:03:03 +0200
commit3629cc0bfd4ccb6c309d30021be8a4011f551ca9 (patch)
tree0018ba35e246b6785aaae292bdb64e480ea0a444 /data/rbot/plugins
parentf01977130a8d23d8806c3087cbbb54ea4a9e0431 (diff)
figlet plugin: make it more friendly to external usage
Diffstat (limited to 'data/rbot/plugins')
-rw-r--r--data/rbot/plugins/figlet.rb6
1 files 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