From c3e2d59d3e081141fcdcd5ee43469c3c4a7586db Mon Sep 17 00:00:00 2001 From: Yaohan Chen Date: Mon, 30 Nov 2009 14:44:11 -0500 Subject: When a translator fails to initialize, map its command to respond the reason --- data/rbot/plugins/translator.rb | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'data/rbot') diff --git a/data/rbot/plugins/translator.rb b/data/rbot/plugins/translator.rb index d4f55444..8617c321 100644 --- a/data/rbot/plugins/translator.rb +++ b/data/rbot/plugins/translator.rb @@ -284,6 +284,8 @@ class TranslatorPlugin < Plugin rescue Exception warning _("Translator %{name} cannot be used: %{reason}") % {:name => name, :reason => $!} + map "#{name} [*args]", :action => :failed_translator, + :defaults => {:name => name, :reason => $!} end end @@ -295,6 +297,11 @@ class TranslatorPlugin < Plugin update_default end + def failed_translator(m, params) + m.reply _("Translator %{name} cannot be used: %{reason}") % + {:name => params[:name], :reason => params[:reason]} + end + def help(plugin, topic=nil) if @translators.has_key?(plugin) translator = @translators[plugin] -- cgit v1.2.3