def on_PluginsLoaded(self, event): cmds = Modifier.get("command") self.commands = {} for cmd in cmds: a = cmd.annotation["command"] [ self.commands.update({n.lower(): (cmd, a)}) for n in a.get("aliases", []) + [a["args"][0]] ]
def handle_reload(self, event): cmds = Modifier.get("match") self.matches = [] for cmd in cmds: a = cmd.annotation["match"] [ self.matches.append((cmd, a, self.setup_regex(n))) for n in a.get("aliases", []) + [a["args"][0]] ] print self.matches
def handle_reload(self, event): self.tasks = {} tasks = Modifier.get("repeat") for t in tasks: a = t.annotation["repeat"] if self.tasks.has_key(a["args"][0]): print "Already a task with the name {}, error loading second one from plugin {}".format(a["args"][0], t.plugin.name) continue l = task.LoopingCall(t, PluginManager.instance.instances[t.plugin]) if a.get("autostart", False): if self.bot.irc is None: self.autostart.append(partial(l.start, a.get("time", 1.0))) else: l.start(a.get("time", 1.0)) self.tasks[a["args"][0]] = l
def handle_reload(self, event): self.tasks = {} tasks = Modifier.get("repeat") for t in tasks: a = t.annotation["repeat"] if self.tasks.has_key(a["args"][0]): print "Already a task with the name {}, error loading second one from plugin {}".format( a["args"][0], t.plugin.name) continue l = task.LoopingCall(t, PluginManager.instance.instances[t.plugin]) if a.get("autostart", False): if self.bot.irc is None: self.autostart.append(partial(l.start, a.get("time", 1.0))) else: l.start(a.get("time", 1.0)) self.tasks[a["args"][0]] = l
def reload(self): # self.plugins = PluginManager(self) self.config.loadOrCreate() self.plugins.disableAll() Modifier.forgetEverything() self.plugins.load_plugins("ZomgBot.plugins")
def _stop(self, quit_message="Asked to quit"): self.plugins.disableAll() Modifier.forgetEverything() self.irc.actually_quit = True self.irc.quit(quit_message)
def on_PluginsLoaded(self, event): cmds = Modifier.get("command") self.commands = {} for cmd in cmds: a = cmd.annotation["command"] [self.commands.update({n.lower(): (cmd, a)}) for n in a.get("aliases", []) + [a["args"][0]]]
def reload(self): #self.plugins = PluginManager(self) self.config.loadOrCreate() self.plugins.disableAll() Modifier.forgetEverything() self.plugins.load_plugins("ZomgBot.plugins")