Exemplo n.º 1
0
    saveSettings()

if "lastOp" not in clientSettings:
    clientSettings["lastOp"] = None
if clientSettings["lastOp"] is not None:
    op = eval(clientSettings["lastOp"])
    if op.type == 25:
        if op.message.text == "{}reboot".format(clientSettings["prefix"]):
            rebootMSG = ""
            if "rebootTime" in clientSettings:
                totalTime = str(time.time() -
                                clientSettings["rebootTime"]).split(".")
                totalTime = totalTime[0] + "." + totalTime[1][:2]
                rebootMSG = " - {} วินาที".format(totalTime)
            client.sendMessage(
                op.message.to,
                "เริ่มระบบใหม่อีกครั้งเรียบร้อยแล้ว{}".format(rebootMSG))
            clientSettings["lastOp"] = None
    else:
        execute(op)

while True:
    ops = clientPoll.singleTrace(count=100)
    if ops != None:
        for op in ops:
            try:
                clientSettings["lastOp"] = str(op)
                execute(op)
            except Exception as e:
                clientErrorOrNewPatch.append(e)
                client.sendMessage(
Exemplo n.º 2
0
    saveSettings()

if "lastOp" not in clientSettings:
    clientSettings["lastOp"] = None
if clientSettings["lastOp"] is not None:
    op = eval(clientSettings["lastOp"])
    if op.type == 25:
        if op.message.text == "{}reboot".format(clientSettings["prefix"]):
            rebootMSG = ""
            if "rebootTime" in clientSettings:
                totalTime = str(time.time() -
                                clientSettings["rebootTime"]).split(".")
                totalTime = totalTime[0] + "." + totalTime[1][:2]
                rebootMSG = " - {} Secs".format(totalTime)
            client.sendMessage(
                op.message.to,
                "The system is restarted successfully.{}".format(rebootMSG))
            clientSettings["lastOp"] = None
    else:
        execute(op)

while True:
    ops = clientPoll.singleTrace(count=100)
    if ops != None:
        for op in ops:
            try:
                clientSettings["lastOp"] = str(op)
                execute(op)
            except Exception as e:
                clientErrorOrNewPatch.append(e)
                client.sendMessage(