mirror of
https://github.com/Mikaela/Limnoria.git
synced 2024-11-23 11:09:23 +01:00
Added an apropos command.
This commit is contained in:
parent
e8284ca938
commit
d28b015b52
17
src/Misc.py
17
src/Misc.py
@ -157,6 +157,23 @@ class Misc(callbacks.Privmsg):
|
||||
irc.error(msg, 'There is no plugin named %s, ' \
|
||||
'or that plugin has no commands.' % name)
|
||||
|
||||
def apropos(self, irc, msg, args):
|
||||
"""<string>
|
||||
|
||||
Searches for <string> in the commands currently offered by the bot,
|
||||
returning a list of the commands containing that string.
|
||||
"""
|
||||
s = privmsgs.getArgs(args)
|
||||
L = []
|
||||
for cb in irc.callbacks:
|
||||
if isinstance(cb, callbacks.Privmsg) and \
|
||||
not isinstance(cb, callbacks.PrivmsgRegexp):
|
||||
for attr in dir(cb):
|
||||
if s in attr and cb.isCommand(attr):
|
||||
L.append(callbacks.canonicalName(attr))
|
||||
L.sort()
|
||||
irc.reply(msg, utils.commaAndify(L))
|
||||
|
||||
def help(self, irc, msg, args):
|
||||
"""[<plugin>] <command>
|
||||
|
||||
|
@ -135,6 +135,10 @@ class MiscTestCase(ChannelPluginTestCase, PluginDocumentation):
|
||||
def testHostmask(self):
|
||||
self.assertResponse('hostmask', self.prefix)
|
||||
|
||||
def testApropos(self):
|
||||
self.assertNotError('apropos f')
|
||||
|
||||
|
||||
|
||||
# vim:set shiftwidth=4 tabstop=8 expandtab textwidth=78:
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user