Exemplo n.º 1
0
def command(msg):
    msg = msg[7: ]
    global brake
    global dl
    if(not brake):
        t.join()
    if msg.startswith("tilaa"):
        #print (msg)
        tilaa(msg)

    elif msg.startswith("help"):
        apu()
    elif msg.startswith("apua"):
        apu()
    elif msg.startswith("setdeadline"):
        dl = deadline.setDeadLine(msg)
        if(not t.is_alive()):
            t.start()
    elif msg.startswith("timeleft"):
        sendmsg(deadline.deadLine(dl)[0])
        sendmsg(deadline.deadLine(dl)[1])
    elif msg.startswith("showlist"):
        showList()
    elif msg.startswith("showmenu"): #Muista valita mikä menu listataan (vaihtoehdot [muut, pizzat])
        if (" ") in msg:
            showMenu(msg.split(" ")[1])
        else:
            sendmsg("Syntaxi komennolle on !pizza-showmenu [muut tai pizzat]")
Exemplo n.º 2
0
def command(msg):
    msg = msg[7:]
    global brake
    global dl
    if (not brake):
        t.join()
    if msg.startswith("tilaa"):
        #print (msg)
        tilaa(msg)

    elif msg.startswith("help"):
        apu()
    elif msg.startswith("apua"):
        apu()
    elif msg.startswith("setdeadline"):
        dl = deadline.setDeadLine(msg)
        if (not t.is_alive()):
            t.start()
    elif msg.startswith("timeleft"):
        sendmsg(deadline.deadLine(dl)[0])
        sendmsg(deadline.deadLine(dl)[1])
    elif msg.startswith("showlist"):
        showList()
    elif msg.startswith(
            "showmenu"
    ):  #Muista valita mikä menu listataan (vaihtoehdot [muut, pizzat])
        if (" ") in msg:
            showMenu(msg.split(" ")[1])
        else:
            sendmsg("Syntaxi komennolle on !pizza-showmenu [muut tai pizzat]")
Exemplo n.º 3
0
def pizzaWatch():
    global dl
    while(True):
        hours = float(deadline.deadLine(dl)[1][8:])
        print (hours)
        if (hours <0):
            global brake
            brake = False
            sendmsg("Deadline on ohi")
        elif (hours <= 0.25):
            sendmsg("Alle 15 minuuttia deadlineen!")
        elif(hours <= 0.5):
            sendmsg("Alle puoli tuntia deadlineen!")
        elif(hours <= 1):
            sendmsg("Alle tunti deadlineen!")
        elif(hours <= 2):
            sendmsg("Alle 2 tuntia deadlineen!")
        time.sleep(360)
Exemplo n.º 4
0
def pizzaWatch():
    global dl
    while (True):
        hours = float(deadline.deadLine(dl)[1][8:])
        print(hours)
        if (hours < 0):
            global brake
            brake = False
            sendmsg("Deadline on ohi")
        elif (hours <= 0.25):
            sendmsg("Alle 15 minuuttia deadlineen!")
        elif (hours <= 0.5):
            sendmsg("Alle puoli tuntia deadlineen!")
        elif (hours <= 1):
            sendmsg("Alle tunti deadlineen!")
        elif (hours <= 2):
            sendmsg("Alle 2 tuntia deadlineen!")
        time.sleep(360)