This commit is contained in:
Jeremy Fincher 2003-12-07 00:13:56 +00:00
parent f6f46f6689
commit 2fea3e788e

View File

@ -74,28 +74,34 @@ class Misc(callbacks.Privmsg):
if option == '--private': if option == '--private':
evenPrivate = True evenPrivate = True
name = privmsgs.getArgs(rest, required=0, optional=1) name = privmsgs.getArgs(rest, required=0, optional=1)
name = name.lower() name = callbacks.canonicalName(name)
if not name: if not name:
names = [cb.name() for cb in irc.callbacks names = [cb.name() for cb in irc.callbacks
if evenPrivate or (hasattr(cb, 'public') and cb.public)] if evenPrivate or (hasattr(cb, 'public') and cb.public)]
names.sort() names.sort()
irc.reply(msg, ', '.join(names)) irc.reply(msg, ', '.join(names))
else: else:
for cb in irc.callbacks: cb = irc.getCallback(name)
cls = cb.__class__ if cb is None:
if cb.name().lower() == name and \ irc.error(msg, 'No such plugin %r exists.' % name)
not issubclass(cls, callbacks.PrivmsgRegexp) and \ elif isinstance(cb, callbacks.PrivmsgRegexp) or \
issubclass(cls, callbacks.Privmsg): not isinstance(cb, callbacks.Privmsg):
commands = [x for x in dir(cls) irc.error(msg, 'That plugin exists, but it has no commands.')
if cb.isCommand(x) and else:
hasattr(getattr(cb, x), '__doc__') and commands = []
callbacks.canonicalName(x) == x and for s in dir(cb):
callbacks.canonicalName(x)!=cb.name().lower()] if cb.isCommand(s) and \
s != name and \
s == callbacks.canonicalName(s):
method = getattr(cb, s)
if hasattr(method, '__doc__') and method.__doc__:
commands.append(s)
if commands:
commands.sort() commands.sort()
irc.reply(msg, ', '.join(commands)) irc.reply(msg, ', '.join(commands))
return else:
irc.error(msg, 'There is no plugin named %s, ' \ irc.error(msg, 'That plugin exists, but it has no '
'or that plugin has no commands.' % name) 'commands with help.')
def apropos(self, irc, msg, args): def apropos(self, irc, msg, args):
"""<string> """<string>