From c67a3eae192a8ce34adeff028b8d961508f1ec99 Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Tue, 21 Oct 2003 07:26:29 +0000 Subject: [PATCH] Fixed ambiguous error handling. --- src/Misc.py | 21 ++++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/src/Misc.py b/src/Misc.py index 58781902c..f7f004fa8 100755 --- a/src/Misc.py +++ b/src/Misc.py @@ -97,15 +97,22 @@ class Misc(callbacks.Privmsg): irc = callbacks.IrcObjectProxyRegexp(irc) replyWhenNotCommand(irc, msg, notCommands) elif ambiguousCommands: - L = [] - while ambiguousCommands: + if len(ambiguousCommands) == 1: # Common case. (command, cbs) = ambiguousCommands.popitem() - L.append('%s is available in the %s plugins' % \ + s = 'The command %r is available in the plugins %s. '\ + 'Please specify the plugin whose command you ' \ + 'wish to call by using its name as a command ' \ + 'before %r' % \ + (command, utils.commaAndify(cbs), command) + else: + L = [] + while ambiguousCommands: + (command, cbs) = ambiguousCommands.popitem() + L.append('%r is available in the plugins %s' % \ (command, utils.commaAndify(cbs))) - s = '%s; please specify which plugins to call %s from.' % \ - ('; '.join(L), - len(L) > 1 and 'these commands' or 'this command') - irc.error(msg, s) + s = '%s; please specify from which plugins to ' \ + 'call these commands.' % '; '.join(L) + irc.queueMsg(callbacks.reply(msg, 'Error: ' + s)) def list(self, irc, msg, args): """[--private] []