]> jfr.im git - erebus.git/commitdiff
Implement modlist, fix "no such cmd" error
authorJohn Runyon <redacted>
Thu, 23 Jan 2014 23:17:50 +0000 (17:17 -0600)
committerJohn Runyon <redacted>
Thu, 23 Jan 2014 23:17:50 +0000 (17:17 -0600)
bot.py
ctlmod.py
modules/module.py

diff --git a/bot.py b/bot.py
index 55c205df6cdfc88068ba9a7231a76db05c4065e2..09df1dbc1547e99036f78e3553517000266a473f 100644 (file)
--- a/bot.py
+++ b/bot.py
@@ -121,8 +121,8 @@ class Bot(object):
                                        if cbret is NotImplemented:
                                                self.msg(user, "Command not implemented.")
                                        continue
-
-               self.msg(user, "No such command, or you don't have access.")
+               else:
+                       self.msg(user, "No such command, or you don't have access.")
 
        def msg(self, target, msg):
                if isinstance(target, self.parent.User): self.conn.send("NOTICE %s :%s" % (target.nick, msg))
index b6fe1a969c085a417821a0546c66dcc1e10a1836..d5e6debd09bfe24da6d1d5c0207cdf2adbdc6df2 100644 (file)
--- a/ctlmod.py
+++ b/ctlmod.py
@@ -15,6 +15,9 @@ def load(parent, modname):
                mod = __import__(modname)
                reload(mod)
 
+               if not hasattr(mod, 'modinfo'):
+                       return modlib.error('no modinfo')
+
                if 1 not in mod.modinfo['compatible']:
                        return modlib.error('API-incompatible')
 
index 3d9b3e1aec7c9b62e8979a1f66fe8a7abca56958..1e3e3e156ede2c6280ffb915a72ee65a5c64ee0e 100644 (file)
@@ -46,4 +46,7 @@ def cmd_modreload(bot, user, chan, realtarget, *args):
 @lib.hook('modlist', needchan=False, glevel=lib.STAFF)
 @lib.argsEQ(0)
 def cmd_modlist(bot, user, chan, realtarget, *args):
-       return NotImplemented
+       mods = ctlmod.modules
+       for mod in mods.itervalues():
+               bot.msg(user, "- %s %r" % (mod.__name__, mod))
+       bot.msg(user, "Done.")