Пример #1
0
def home_request_app(cmd):
    result = ""
    r = ''
    db = None
    try:
        db = DB_Manager.openDB(db, 'system.db')
        DB_Manager.insert_TB_HOME_COM(db, cmd)
        r = DB_Manager.select_last_TB_HOME_COM(db)
        if int(r[0]) > 0:
            time.sleep(3)
            result = DB_Manager.select_TB_HOME_COM(db, str(r[0]))
            if result != "":
                result = result[4]
    except Exception as e:
        print "Sub:home_request Error:", e
    finally:
        DB_Manager.closeDB(db)
        return result
Пример #2
0
def home_request(chat_id, cmd):
    result = ""
    r = ''
    db = None
    try:
        if auth_permission(chat_id) == True and chat_id != '':
            db = DB_Manager.openDB(db, 'system.db')
            DB_Manager.insert_TB_HOME_COM(db, cmd)
            r = DB_Manager.select_last_TB_HOME_COM(db)
            if int(r[0]) > 0:
                time.sleep(3)
                result = DB_Manager.select_TB_HOME_COM(db, str(r[0]))
                if result != "":
                    result = result[4]
        else:
            result = "Non hai l'autorizzazione per questo genere di comandi!"
    except Exception as e:
        print "Sub:home_request Error:", e
    finally:
        DB_Manager.closeDB(db)
        return result