Added the plugin name to the command if the command is abiguous.

This commit is contained in:
Jeremy Fincher 2003-10-26 17:39:01 +00:00
parent 7ba9a855bb
commit fbd08fe704

View File

@ -166,13 +166,20 @@ class Misc(callbacks.Privmsg):
returning a list of the commands containing that string. returning a list of the commands containing that string.
""" """
s = privmsgs.getArgs(args) s = privmsgs.getArgs(args)
commands = {}
L = [] L = []
for cb in irc.callbacks: for cb in irc.callbacks:
if isinstance(cb, callbacks.Privmsg) and \ if isinstance(cb, callbacks.Privmsg) and \
not isinstance(cb, callbacks.PrivmsgRegexp): not isinstance(cb, callbacks.PrivmsgRegexp):
for attr in dir(cb): for attr in dir(cb):
if s in attr and cb.isCommand(attr): if s in attr and cb.isCommand(attr):
L.append(callbacks.canonicalName(attr)) commands.setdefault(attr, []).append(cb.name())
for (key, names) in commands.iteritems():
if len(names) == 1:
L.append(key)
else:
for name in names:
L.append('%s %s' % (name, key))
L.sort() L.sort()
irc.reply(msg, utils.commaAndify(L)) irc.reply(msg, utils.commaAndify(L))