diff --git a/modules/events/__init__.py b/modules/events/__init__.py index 5d2c48d..1aceb2b 100644 --- a/modules/events/__init__.py +++ b/modules/events/__init__.py @@ -110,7 +110,10 @@ def parseanswer(msg): msg.send_snd ("Compteurs connus : %s." % ", ".join(DATAS.index.keys())) elif msg.cmd[0] in DATAS.index: if DATAS.index[msg.cmd[0]].name == "strend": - msg.send_chn ("%s commencé il y a %s." % (msg.cmd[0], msg.just_countdown(datetime.now () - DATAS.index[msg.cmd[0]].getDate("start")))) + if DATAS.index[msg.cmd[0]].hasAttribute("end"): + msg.send_chn ("%s commencé il y a %s et se terminera dans %s." % (msg.cmd[0], msg.just_countdown(datetime.now() - DATAS.index[msg.cmd[0]].getDate("start")), msg.just_countdown(DATAS.index[msg.cmd[0]].getDate("end") - datetime.now()))) + else: + msg.send_chn ("%s commencé il y a %s." % (msg.cmd[0], msg.just_countdown(datetime.now () - DATAS.index[msg.cmd[0]].getDate("start")))) else: msg.send_chn (msg.countdown_format (DATAS.index[msg.cmd[0]].getDate("start"), DATAS.index[msg.cmd[0]]["msg_before"], DATAS.index[msg.cmd[0]]["msg_after"])) save() diff --git a/prompt.py b/prompt.py index 0af6196..b29d01a 100644 --- a/prompt.py +++ b/prompt.py @@ -115,7 +115,15 @@ def mod_has_access(mod, config, msg): def load_module_from_name(name, servers, config=None): try: #Import the module code - mod = __import__(name) + loaded = False + for md in MODS: + if md.name == name: + mod = imp.reload(md) + loaded = True + break + if not loaded: + mod = __import__(name) + imp.reload(mod) try: if mod.nemubotversion < 3.0: print (" Module `%s' is not compatible with this version." % name) @@ -166,7 +174,13 @@ def load_module_from_name(name, servers, config=None): except AttributeError: print (" Module `%s' successfully added." % name) #TODO: don't append already running modules - MODS.append(mod) + exitsts = False + for md in MODS: + if md.name == name: + exitsts = True + break + if not exitsts: + MODS.append(mod) except AttributeError: print (" Module `%s' is not a nemubot module." % name) for srv in servers: