Updated Status to use some of the new methods.

This commit is contained in:
Jeremy Fincher 2005-02-19 23:44:50 +00:00
parent 66036c344f
commit 06a6656dc7

View File

@ -164,12 +164,9 @@ class Status(callbacks.Plugin):
commands = 0 commands = 0
callbacksPlugin = 0 callbacksPlugin = 0
for cb in irc.callbacks: for cb in irc.callbacks:
if isinstance(cb, callbacks.Plugin) and cb.public: if isinstance(cb, callbacks.Plugin):
callbacksPlugin += 1 callbacksPlugin += 1
for attr in dir(cb): commands += len(cb.listCommands())
if cb.isCommand(attr) and \
attr == callbacks.canonicalName(attr):
commands += 1
s = format('I offer a total of %n in %n. I have processed %n.', s = format('I offer a total of %n in %n. I have processed %n.',
(commands, 'command'), (commands, 'command'),
(callbacksPlugin, 'command-based', 'plugin'), (callbacksPlugin, 'command-based', 'plugin'),
@ -184,14 +181,10 @@ class Status(callbacks.Plugin):
""" """
commands = set() commands = set()
for cb in irc.callbacks: for cb in irc.callbacks:
if isinstance(cb, callbacks.Plugin) and cb.public: if isinstance(cb, callbacks.Plugin):
for attr in dir(cb): for command in cb.listCommands():
if cb.isCommand(attr) and \ commands.add(command)
attr == callbacks.canonicalName(attr): irc.reply(format('%L', sorted(commands)))
commands.add(attr)
commands = list(commands)
commands.sort()
irc.reply(format('%L', commands))
commands = wrap(commands) commands = wrap(commands)
def uptime(self, irc, msg, args): def uptime(self, irc, msg, args):