mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-02 17:29:22 +01:00
Fixed ambiguous error handling.
This commit is contained in:
parent
ec626896d3
commit
c67a3eae19
21
src/Misc.py
21
src/Misc.py
@ -97,15 +97,22 @@ class Misc(callbacks.Privmsg):
|
|||||||
irc = callbacks.IrcObjectProxyRegexp(irc)
|
irc = callbacks.IrcObjectProxyRegexp(irc)
|
||||||
replyWhenNotCommand(irc, msg, notCommands)
|
replyWhenNotCommand(irc, msg, notCommands)
|
||||||
elif ambiguousCommands:
|
elif ambiguousCommands:
|
||||||
L = []
|
if len(ambiguousCommands) == 1: # Common case.
|
||||||
while ambiguousCommands:
|
|
||||||
(command, cbs) = ambiguousCommands.popitem()
|
(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)))
|
(command, utils.commaAndify(cbs)))
|
||||||
s = '%s; please specify which plugins to call %s from.' % \
|
s = '%s; please specify from which plugins to ' \
|
||||||
('; '.join(L),
|
'call these commands.' % '; '.join(L)
|
||||||
len(L) > 1 and 'these commands' or 'this command')
|
irc.queueMsg(callbacks.reply(msg, 'Error: ' + s))
|
||||||
irc.error(msg, s)
|
|
||||||
|
|
||||||
def list(self, irc, msg, args):
|
def list(self, irc, msg, args):
|
||||||
"""[--private] [<module name>]
|
"""[--private] [<module name>]
|
||||||
|
Loading…
Reference in New Issue
Block a user