Fixed ambiguous error handling.

This commit is contained in:
Jeremy Fincher 2003-10-21 07:26:29 +00:00
parent ec626896d3
commit c67a3eae19

View File

@ -97,15 +97,22 @@ class Misc(callbacks.Privmsg):
irc = callbacks.IrcObjectProxyRegexp(irc)
replyWhenNotCommand(irc, msg, notCommands)
elif ambiguousCommands:
if len(ambiguousCommands) == 1: # Common case.
(command, cbs) = ambiguousCommands.popitem()
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('%s is available in the %s plugins' % \
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] [<module name>]