diff options
author | Yaohan Chen <yaohan.chen@gmail.com> | 2007-11-26 05:15:52 +0000 |
---|---|---|
committer | Yaohan Chen <yaohan.chen@gmail.com> | 2007-11-26 05:15:52 +0000 |
commit | e2bad2a87f98ee801498bd8879570c13be072f6c (patch) | |
tree | 7aace50104fffd2d8e9deeb2ab7a7fc130f3999f /data/rbot | |
parent | 02d0166ba355be0419c39eea85f9f8dcf13f04d9 (diff) |
alias.rb:
* show a clear error message when the alias is removed but mapping is not yet
Diffstat (limited to 'data/rbot')
-rw-r--r-- | data/rbot/plugins/alias.rb | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/data/rbot/plugins/alias.rb b/data/rbot/plugins/alias.rb index 3339db7f..a587736c 100644 --- a/data/rbot/plugins/alias.rb +++ b/data/rbot/plugins/alias.rb @@ -128,6 +128,7 @@ class AliasPlugin < Plugin def method_missing(name, *args, &block) if name.to_s =~ /\Aalias_handle<(.+)>\Z/ + text = $1 m, params = args # messages created by alias handler will have a depth method, which returns the # depth of "recursion" caused by the message @@ -137,11 +138,11 @@ class AliasPlugin < Plugin return end - command = @aliases[$1] + command = @aliases[text] if command # create a fake message containing the intended command new_msg = PrivMessage.new(@bot, m.server, m.server.user(m.source), m.target, - command.gsub(/<(\w+)>/) {|arg| params[:"#{$1}"].to_s}) + command.gsub(/<(\w+)>/) {|arg| params[:"#{$1}"].to_s}) # tag incremented depth on the message class << new_msg self @@ -149,7 +150,8 @@ class AliasPlugin < Plugin @bot.plugins.privmsg(new_msg) else - m.reply _("Error handling the alias, the command is not defined") + m.reply(_("Error handling the alias, The alias %{text} is not defined or has beeen removed. I will stop responding to it after rescan,") % + {:text => text}) end else super(name, *args, &block) |