From aead137ed751c1283c5eb6f23c5a6f675125b7c4 Mon Sep 17 00:00:00 2001 From: Ryan Hitchman Date: Mon, 30 Mar 2009 17:40:43 -0600 Subject: [PATCH] minor edit to plugin reloading (dir() -> vars()) --- bot.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/bot.py b/bot.py index 899e347..8cfba01 100755 --- a/bot.py +++ b/bot.py @@ -42,10 +42,9 @@ def reload_plugins(mtime=[0]): shortname = os.path.splitext(os.path.basename(filename))[0] try: plugin = imp.load_source(shortname, filename) - for thing in dir(plugin): - thing = getattr(plugin, thing) - if hasattr(thing, '_skybot_hook'): - for type, data in thing._skybot_hook: + for obj in vars(plugin).itervalues(): + if hasattr(obj, '_skybot_hook'): #check for magic + for type, data in obj._skybot_hook: bot.plugs[type] += [data] except Exception, e: print ' error:', e