allow job registration after module loads
This commit is contained in:
parent
240400439e
commit
d89b6e6d32
1 changed files with 2 additions and 0 deletions
|
@ -40,6 +40,7 @@ class RtmBot(object):
|
||||||
function_name = "process_" + data["type"]
|
function_name = "process_" + data["type"]
|
||||||
dbg("got {}".format(function_name))
|
dbg("got {}".format(function_name))
|
||||||
for plugin in self.bot_plugins:
|
for plugin in self.bot_plugins:
|
||||||
|
plugin.register_jobs()
|
||||||
plugin.do(function_name, data)
|
plugin.do(function_name, data)
|
||||||
def output(self):
|
def output(self):
|
||||||
for plugin in self.bot_plugins:
|
for plugin in self.bot_plugins:
|
||||||
|
@ -84,6 +85,7 @@ class Plugin(object):
|
||||||
for interval, function in self.module.crontable:
|
for interval, function in self.module.crontable:
|
||||||
self.jobs.append(Job(interval, eval("self.module."+function)))
|
self.jobs.append(Job(interval, eval("self.module."+function)))
|
||||||
logging.info(self.module.crontable)
|
logging.info(self.module.crontable)
|
||||||
|
self.module.crontable = []
|
||||||
else:
|
else:
|
||||||
self.module.crontable = []
|
self.module.crontable = []
|
||||||
def do(self, function_name, data):
|
def do(self, function_name, data):
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue