Example #1
0
def control(bot):
    global update_id

    for update in bot.get_updates(offset=update_id, timeout=10):
        update_id = update.update_id + 1
        action_list = [["کنترل هوشمند", "کنترل دستی", "خاتمه"], [""]]
        sleep(1)
        update.message.reply_text(
            "لطفا یکی از گزینه‌های زیر را انتخاب نمائید : ",
            reply_markup=telegram.ReplyKeyboardMarkup(action_list,
                                                      one_time_keyboard=True))

        if update.message:
            if update.message.text == "کنترل هوشمند":
                import smart
                smart.main()
                sleep(1)

            elif update.message.text == "کنترل دستی":
                import manual
                manual.main()
                sleep(1)

            elif update.message.text == "خاتمه":
                import sys
                #sys.exit(0)
                print("salam")

        else:
            time.sleep(2)
Example #2
0
            f.write(today)
        print("Changes successfully made. Last updated date is now " + today)


switch = True
while (switch):

    #Prompt user to input (i.e. help)
    command = input('>>> ')

    #Redirects the main to call other python scripts accordingly
    #Refer to help page for details of each command
    if (command[0:4] == "help"):
        if (len(command) > 4):
            entry = command[5:].strip()
            man.main(entry)
        else:
            man.main()
    elif (command[0:7] == "extract"):
        success = True
        try:
            if (command[7:].find(" -l") > -1):
                list_updated.main()
            if (extract_ExoPlanet.get() != -1):
                extract_ExoPlanet.parse()
            if (extract_NASA.get() != -1):
                extract_NASA.parse()
        except:
            print(
                "Extraction from external sources failed. Try closing all opened CSV files and try again"
            )
Example #3
0
import list_updated as list_updated
import manual as man
import translate_ExoPlanet as translate_Exoplanet
import translate_NASA as translate_NASA

switch = True
while (switch):

    #Prompt user to input (i.e. help)
    command = input('>>>')

    #Redirects the main to call other python scripts accordingly
    #Refer to help page for details of each command
    if (command == "help"):
        man.main()
    elif (command[0:7] == "updated"):
        #TODO: handle opened file exceptions
        list_updated.main()
        translate_Exoplanet.get()
        translate_Exoplanet.parse()
        translate_NASA.get()
        translate_NASA.parse()
    elif (command[0:4] == "push"):
        push.main()
    elif (command == "exit"):
        switch = False
    else:
        print(
            "'" + command +
            "' is not an available command. Enter 'help' for list of available commands."
        )
Example #4
0
import manual

manual.main()