diff --git a/reload.py b/reload.py index 187fdf71dd..bc9789e986 100644 --- a/reload.py +++ b/reload.py @@ -29,14 +29,14 @@ def f_reload(bot, trigger): if name == bot.config.owner: return bot.reply('What?') - if (not name) or (name == '*') or (name.upper() == 'ALL THE THINGS'): + if not name or name == '*' or name.upper() == 'ALL THE THINGS': bot.callables = None bot.commands = None bot.setup() return bot.reply('done') - if not name in sys.modules: - return bot.reply('%s: no such module!' % name) + if name not in sys.modules: + return bot.reply('%s: not loaded, try the `load` command' % name) old_module = sys.modules[name] @@ -77,23 +77,18 @@ def f_reload(bot, trigger): bot.reply('%r (version: %s)' % (module, modified)) -if sys.version_info >= (2, 7): - @willie.module.nickname_commands('update') - def f_update(bot, trigger): - if not trigger.admin: - return +@willie.module.nickname_commands('update') +def f_update(bot, trigger): + if not trigger.admin: + return - """Pulls the latest versions of all modules from Git""" - proc = subprocess.Popen('/usr/bin/git pull', - stdout=subprocess.PIPE, - stderr=subprocess.PIPE, shell=True) - bot.reply(proc.communicate()[0]) + """Pulls the latest versions of all modules from Git""" + proc = subprocess.Popen('/usr/bin/git pull', + stdout=subprocess.PIPE, + stderr=subprocess.PIPE, shell=True) + bot.reply(proc.communicate()[0]) - f_reload(bot, trigger) -else: - @willie.module.nickname_commands('update') - def f_update(bot, trigger): - bot.say('You need to run me on Python 2.7 to do that.') + f_reload(bot, trigger) @willie.module.nickname_commands("load")