import yaml

from app.commander import Commander

crontable = []
outputs = []

# Instantiate commader!
config = yaml.load(open('rtmbot.conf', 'r'))
commander = Commander(config)

# main message processing


def process_message(data):
    if config["DEBUG"]:
        print(data)

    response = commander.process_message(data)
    if response:
        outputs.append([data['channel'], response])

# crontable functions


def periodic_nag():
    for channel, message in commander.nag():
        outputs.append([channel, message])


def periodic_updates():
    for channel, message in commander.update():
        outputs.append([channel, message])


# Add function to crontable
crontable.append([15, "periodic_nag"])
crontable.append([60, "periodic_updates"])

@@ -688,16 +688,22 @@
 pend(%5B15
+ * 60 
 , %22perio
@@ -712,16 +712,39 @@
 c_nag%22%5D)
+ # nag every 15 minutes
 %0Acrontab
@@ -754,18 +754,24 @@
 append(%5B
+90 * 
 60
+ 
 , %22perio
@@ -784,9 +784,35 @@
 dates%22%5D)
+ # update every 90 minutes
 %0A

Fix nag times