예제 #1
0
def start():
    while 1:
        the_voice.say_and_print("Use default sender,\"python\" ? say yes, no, or \"CANCEL\" to cancel")
        use_it = the_voice.listening()
        while 1:
            try:
                use_it = use_it.lower()
                if use_it == "cancel":
                    return
                break
            except:
                print("Say yes , no, or \"CANCEL\" to cancel")
            use_it = the_voice.listening()
        if use_it == "yes":
            # using default sender python
            decrypt('data_files/sender.txt', key)
            with open('data_files/sender.txt', mode='r', encoding='utf-8') as open_sender:
                for senders in open_sender:
                    if "python" == senders.split()[0].lower().rstrip():
                        BY = senders.split()[1].lower().rstrip()

                        try:
                            s.login(BY, senders.split()[2].lower().rstrip())
                            the_voice.say_and_print("Login successful!")
                        except Exception as e:
                            print("Something is wrong with sender credentials or account access settings!")
                            print(e)
                            encrypt('data_files/sender.txt', key)
                            return
                        send(BY, key)
                    else:
                        the_voice.say_and_print("Default user data destroyed!")
                        the_voice.say_and_print("Enter new user data")
                        update_sender()
            encrypt('data_files/sender.txt', key)
        elif use_it == "cancel":
            return
        elif use_it == "no":
            the_voice.say_and_print("Choose another sender...")
            update_sender()
        else:
            the_voice.say_and_print("Invalid input")
            continue

        while 1:
            the_voice.say_and_print("Send again, yes or no ")
            flag = the_voice.listening()
            if type(flag) == type("abc"):
                if flag == 'no':
                    encrypt('data_files/mycontacts.txt', key)
                    encrypt('data_files/sender.txt', key)
                    return
                elif flag == 'yes':
                    break
                else:
                    print("Say yes or no?")
            else:
                print("Say yes or no?")
예제 #2
0
def start(cmd):
    if "save workspace" in cmd or ("save" in cmd and "workspace" in cmd):
        the_voice.say_and_print("Saving workspace...")
        store_process.save_unique()
        return 1

    elif "set up workspace" in cmd or ("set" in cmd and "workspace" in cmd):
        the_voice.say_and_print("Setting workspace...")
        set_workspace.open_workspace_apps()
        return 1

    elif "search file" in cmd or ("search" in cmd and "file" in cmd):
        the_voice.say_and_print("Say the file name to search")
        temp = the_voice.listening()
        if temp is None:
            print("Sorry, didn't get you!")
            print(
                "Please say the name of file to search, or \"CANCEL\" to cancel"
            )
            while temp is not None:
                temp = the_voice.listening()
                temp = temp.lower()
                if temp == "cancel":
                    return 1
        temp = temp.lower()
        find.search(temp)
        return 1

    elif "open application" in cmd or ("open" in cmd and "app" in cmd):
        the_voice.say_and_print("Say the application name to open: ")
        temp = the_voice.listening()
        if temp is None:
            print("Sorry, didn't get you!")
            print(
                "Please say the name of file to search, or \"CANCEL\" to cancel"
            )
            while temp is not None:
                temp = the_voice.listening()
                temp = temp.lower()
                if temp == "cancel":
                    return 1
        temp = temp.lower()
        if ".exe" not in temp:
            temp = temp + ".exe"
        app_paths = find.search(temp, "endswith")
        for app_path in app_paths:
            set_workspace.open_app(app_path)
        if len(app_paths) == 0:
            the_voice.say_and_print("No such application found!")
        return 1
    elif "calculate" in cmd or ("run" in cmd and "calculator" in cmd) or (
            "open" in cmd and "calculator" in cmd):
        calculate.start()
        return 1

    return 0
def load_assistant(nm):
    if nm is None or type(nm) != type("abc"):
        print("No such profile!")
        return -1
    nm = nm.lower()
    try:
        fr = open("data_files/" + nm + "_assistant_settings.txt", "r")
    except:
        print("No such profile found!")
        the_voice.say_and_print(
            "Do you want to make a new assistant profile? (yes or no)")
        while True:
            ch = the_voice.listening()
            try:
                ch = ch.lower()
                if ch == "yes":
                    new_profile(nm)
                    return
                elif ch == "no":
                    return -1
                else:
                    print("Please say YES or NO!")
            except:
                print("Please say YES or NO!")
    try:
        temp = fr.read()
        data = eval(temp)
        voice = data["voice"]
        rate = data["rate"]
        name = data["name"]
        greet = data["greet"]
        failure = data["failure"]
        goodbye = data["goodbye"]
        assistant.set_vals(voice, rate, name, greet, failure, goodbye)
    except:
        print("Data in data_files/" + nm +
              "_assistant_settings.txt is corrupted!")
        the_voice.say_and_print(
            "Do you want to make a new assistant profile? (yes or no)")
        while True:
            ch = the_voice.listening()
            try:
                ch = ch.lower()
                if ch == "yes":
                    new_profile(nm)
                    fr.close()
                    return
                elif ch == "no":
                    fr.close()
                    return -1
                else:
                    print("Please say YES or NO!")
            except:
                print("Please say YES or NO!")
    fr.close()
예제 #4
0
def start():
    the_voice.say_and_print("Say what you want to calculate?")
    ex = the_voice.listening()
    while True:
        try:
            ex.lower()
        except:
            print("Say the expression or \"CANCEL\" to cancel")
            ex = the_voice.listening()
            continue
        if ex == "cancel":
            the_voice.say_and_print("okay!")
            return
        result = (calc(ex))
        if result is not None:
            the_voice.say_and_print(str(result))
        print("Say the expression or \"CANCEL\" to cancel")
        ex = the_voice.listening()
def add_contact(name, key):
    decrypt('data_files/phone_book.txt', key)
    with open('data_files/phone_book.txt', mode='a',
              encoding='utf-8') as phone:
        print(
            "Enter whatsapp number along with country code(eg.+91 for india): "
        )
        the_voice.say("Enter whatsapp number along with country code")
        while True:
            number = input(">>>")
            if '+' not in number:
                print("Invalid number(Enter country code also)\nTry again")
                the_voice.say(
                    "Invalid number Enter country code also\n Try again")
            else:
                break
        L = [" \n", name, " ", number]
        phone.writelines(L)
        the_voice.say_and_print(
            "Do you want to send a message to this number, yes or no?")
        while True:
            flag2 = the_voice.listening()
            try:
                flag2 = flag2.lower()
                if flag2 == 'yes':
                    break
                elif flag2 == 'no':
                    encrypt('data_files/phone_book.txt', key)
                    return
                else:
                    the_voice.say_and_print("Please say Yes or No!")
            except:
                print("Sorry, didn't get what you said, please try again")
        RECEIVER = number
        print("Sending to:", RECEIVER)
        the_voice.say("Sending to " + RECEIVER)
        send(RECEIVER, key)
    encrypt('data_files/phone_book.txt', key)
예제 #6
0
def read(BY, key):
    print("connecting to host....")
    try:
        imap = imaplib.IMAP4_SSL(host='imap.gmail.com', port=993)
    except Exception as e:
        print("Error connecting to host or port!")
        print(e)
        return
    print("information encrypted successfully ")
    try:
        imap.starttls()  # Extending the transport layer security
    except Exception as e:
        print("Transfer Layer Security is denied by server")
        pass
    decrypt('data_files/sender.txt', key)
    with open('data_files/sender.txt', mode='r', encoding='utf-8') as f:
        flag = 0
        for item in f:
            if item.split()[1].lower().rstrip() == BY:
                flag = 1
                temp = item
        if flag == 1:
            try:
                imap.login(BY, temp.split()[2].lower().rstrip())
                print("login successful")
                encrypt('data_files/sender.txt', key)
            except Exception as e:
                print(
                    "!! Something is wrong with sender credentials or other app access setting !!"
                )
                print(e)
                exit()
        else:
            print("Data is not written in file!!")
            exit()
    status, messages = imap.select(mailbox='inbox', readonly=True)
    messages = int(messages[0])
    the_voice.say_and_print("How many emails you want to read")
    N = int(the_voice.listening())

    for i in range(messages, messages - N, -1):
        # fetch the email message by ID
        res, msg = imap.fetch(
            message_set=str(i), message_parts="(RFC822)"
        )  # msg gets tuple of message envelope and content
        # print(msg)
        for response in msg:
            if isinstance(response, tuple):
                # parse a bytes email into a message object
                msg = email.message_from_bytes(response[1])  # Message parser
                # decode the email subject
                subject = decode_header(msg["Subject"])[0][
                    0]  # subject is a list of one tuple, first in tuple is our real subject
                if isinstance(subject, bytes):
                    # if it's a bytes, decode to str
                    subject = subject.decode()
                # email sender
                from_ = msg.get("From")
                print("Subject:", subject)
                print("From:", from_)
                # if the email message is multipart
                if msg.is_multipart():
                    # iterate over email parts
                    for part in msg.walk():
                        # extract content type of email
                        content_type = part.get_content_type()
                        # ***
                        content_disposition = str(
                            part.get("Content-Disposition"))
                        try:
                            # get the email body
                            body = part.get_payload(decode=True).decode()
                        except:
                            pass
                        if content_type == "text/plain" and "attachment" not in content_disposition:
                            # print text/plain emails and skip attachments
                            print(body)
                        elif "attachment" in content_disposition:
                            print("There are some attachments also")
                            # download attachment
                            filename = part.get_filename()  # **
                            if filename:
                                if not os.path.isdir('C:/File Attachments'):
                                    # make a folder for this email (named after the subject)
                                    os.mkdir('C:/File Attachments')
                                    print(
                                        " Attachment file is downloaded in C:/File Attachments"
                                    )
                                elif os.path.isdir('C:/File Attachments'):
                                    print(
                                        "The attachment file is already downloaded in C:/File Attachments"
                                    )
                                filepath = os.path.join(
                                    'C:/File Attachments/', filename)
                                # download attachment and save it
                                open(filepath,
                                     "wb").write(part.get_payload(decode=True))
                else:
                    # extract content type of email
                    content_type = msg.get_content_type()
                    # get the email body
                    body = msg.get_payload(decode=True).decode()
                    if content_type == "text/plain":
                        # print only text email parts
                        print(body)
                if content_type == "text/html":
                    print("There is html attachment")
                    # if it's HTML, create a new HTML file and open it in browser
                    if not os.path.isdir('C:/html_attach'):
                        # make a folder for this email (named after the subject)
                        try:
                            os.mkdir('C:/html_attach')
                        except Exception as e:
                            print(e)
                            pass
                    filename = f"{subject[:50]}.html"
                    filepath = os.path.join(
                        'C:/html_attach/',
                        filename)  # os.path.join(path, *paths)
                    # write the file
                    try:
                        open(filepath, "w").write(body)
                        # open in the chrome browser
                        chrome_path = 'C:/Program Files (x86)/Google/Chrome/Application/chrome.exe %s'
                        webbrowser.get(chrome_path).open(filepath)
                    except Exception as e:
                        print(e)
                        pass

                print("=" * 100)
    imap.close()
    imap.logout()
예제 #7
0
def start():
    encryptor_decryptor.safe_key_generator()
    key = encryptor_decryptor.load_key()
    while 1:
        while 1:
            the_voice.say_and_print("Name of user whose inbox is to be opened")
            name = the_voice.listening()
            decrypt('data_files/sender.txt', key)
            with open('data_files/sender.txt', mode='r',
                      encoding='utf-8') as open_sender:
                flag = 0
                for senders in open_sender:
                    if name.lower() == senders.split()[0].lower().rstrip():
                        BY = senders.split()[1].lower().rstrip()
                        flag = 1
                        read(BY, key)
                        break
                encrypt('data_files/sender.txt', key)
                if flag == 0:
                    the_voice.say_and_print(
                        "This person is not in your user's list")
                    while 1:
                        the_voice.say_and_print(
                            "Add this person in list yes or no ?")

                        flag = the_voice.listening()
                        b = type("h")
                        if type(flag) == b:
                            if flag.lower() == 'yes':
                                decrypt('data_files/sender.txt', key)
                                with open('data_files/sender.txt',
                                          mode='a',
                                          encoding='utf-8') as sender:
                                    while 1:
                                        the_voice.say_and_print(
                                            "Tell user's email address")
                                        BY = the_voice.listening()
                                        if '@gmail.com' in BY or '@juitsolan.in' in BY:
                                            L = [" \n", name, " ", BY, " "]
                                            sender.writelines(L)
                                            the_voice.say_and_print(
                                                "Tell password: "******"Continue with this user yes or no ?"
                                                )
                                                flag = "none"
                                                flag = the_voice.listening()
                                                if flag == 'yes':
                                                    read(BY, key)
                                                    break
                                                elif flag == 'no':
                                                    the_voice.say_and_print(
                                                        "Okay")
                                                    break
                                                else:
                                                    the_voice.say_and_print(
                                                        "Try again")
                                            break
                                        else:
                                            the_voice.say_and_print(
                                                "Wrong gmail format")
                                            the_voice.say_and_print(
                                                "Try again")
                                encrypt('data_files/sender.txt', key)
                                break
                            elif flag.lower() == 'no':
                                break
                            else:
                                the_voice.say_and_print("Try again")
                        else:
                            the_voice.say_and_print("Try again")
            while 1:
                the_voice.say_and_print("Read again yes or no ?")
                flag = the_voice.listening()
                b = type("h")
                if type(flag) == b:
                    if flag.lower() == 'yes':
                        break
                    elif flag.lower() == 'no':
                        the_voice.say_and_print("See you again ")
                        return 1
                    else:
                        the_voice.say_and_print("Try again")
                else:
                    the_voice.say_and_print("Try again")
예제 #8
0
def send(BY, key):
    the_voice.say_and_print("Tell the name of receiver or \"CANCEL\" to cancel")
    name = the_voice.listening()
    while 1:
        try:
            name = name.lower()
            if name == "cancel":
                return
            break
        except:
            the_voice.say_and_print("Tell the name of receiver or \"CANCEL\" to cancel")
        name = the_voice.listening()

    decrypt('data_files/mycontacts.txt', key)
    with open('data_files/mycontacts.txt', mode='r', encoding='utf-8') as open_receiver:
        while 1:
            flag = 0
            for receiver in open_receiver:
                name2 = receiver.split()[0].lower().rstrip()
                if name == name2:
                    flag = 1
                    TO = receiver.split()[1].lower().rstrip()
                    TO = TO.rstrip()
            if flag == 0:
                the_voice.say_and_print("This person is not in your receiver's list!")
                the_voice.say_and_print("Add this person in list, yes or no?")
                the_voice.say_and_print("or say \"CANCEL\" to cancel")
                while 1:
                    flag = the_voice.listening()
                    while 1:
                        try:
                            flag = flag.lower()
                            if flag == "cancel":
                                encrypt('data_files/mycontacts.txt', key)
                                return
                            break
                        except:
                            print("Say yes or no, or say \"CANCEL\" to cancel")
                        flag = the_voice.listening()
                    if flag.lower() == 'yes':
                        decrypt('data_files/mycontacts.txt', key)
                        with open('data_files/mycontacts.txt', mode='a', encoding='utf-8') as receive:
                            while 1:
                                the_voice.say_and_print("Enter receiver's email address or \"CANCEL\" to cancel")
                                TO = input(">>>")
                                if type(TO) != type("abc"):
                                    print("Email address can't be empty!")
                                    print("Enter email or \"CANCEL\" to cancel")
                                    continue
                                if "@" in TO and "." in TO:
                                    L = [" \n", name, " ", TO]
                                    receive.writelines(L)
                                    break
                                elif TO.lower() == 'cancel':
                                    encrypt('data_files/mycontacts.txt', key)
                                    return
                                else:
                                    the_voice.say_and_print("Wrong email format!")
                                    the_voice.say_and_print("try again...")
                                    continue
                        encrypt('data_files/mycontacts.txt', key)
                        break
                    elif flag.lower() == 'no':
                        print("Say the name of receiver again or \"CANCEL\" to cancel")
                        name = the_voice.listening()
                        while 1:
                            try:
                                name = name.lower()
                                if name == "cancel":
                                    encrypt('data_files/mycontacts.txt', key)
                                    return
                                break
                            except:
                                print("Tell the name of receiver again or \"CANCEL\" to cancel")
                            name = the_voice.listening()
                        break
                    else:
                        print("Say \"YES\",\"NO\" or \"CANCEL\", try again")
                        continue
            else:
                break
    encrypt('data_files/mycontacts.txt', key)

    the_voice.say_and_print("connecting to host...")
    # s.starttls()  # Extending the transport layer security
    # print("information encrypted...")
    # decrypt('data_files/sender.txt', key)
    # with open('data_files/sender.txt', mode='r', encoding='utf-8') as f:
    #     for item in f:
    #         if item.split()[1].lower().rstrip() == BY:
    #             flag = 1
    #             temp = item
    #     if flag == 1:
    #         try:
    #             s.login(BY, temp.split()[2].lower().rstrip())
    #             print("login successful...\n")
    #             encrypt('data_files/sender.txt', key)
    #         except Exception as e:
    #             print("!! Something is wrong with sender credentials or other app access setting !!")
    #             print(e)
    #             return 1
    #     else:
    #         the_voice.say_and_print("Data is not written in file!!")
    #         return 1
    the_voice.say_and_print("What is the subject or say \"CANCEL\" to cancel")
    SUBJECT = the_voice.listening()
    while 1:
        try:
            SUBJECT = SUBJECT.lower()
            if SUBJECT == "cancel":
                return
            break
        except:
            print("Tell the name of receiver again or \"CANCEL\" to cancel")
        SUBJECT = the_voice.listening()

    while 1:
        the_voice.say_and_print("What is the message or say \"CANCEL\" to cancel")
        body = the_voice.listening()
        while 1:
            try:
                if body.lower() == "cancel":
                    return
                break
            except:
                print("Please tell the message or say \"CANCEL\" to cancel")
            body = the_voice.listening()

        print(body)
        the_voice.say_and_print("Is this correct yes or no?")
        while 1:
            is_it = the_voice.listening()
            while 1:
                try:
                    is_it = is_it.lower()
                    if is_it == "cancel":
                        return
                    break
                except:
                    print("Please say yes or no? Or say \"CANCEL\" to cancel")
                is_it = the_voice.listening()
            if is_it.lower() == "no":
                break
            elif is_it.lower() == "yes":
                msg = MIMEMultipart()
                msg['From'] = BY
                msg['To'] = TO
                msg['Subject'] = SUBJECT
                msg.attach(MIMEText(body, 'plain'))
                try:
                    s.send_message(msg)
                except Exception as e:
                    print("Failed to send!")
                    print(e)
                    return
                the_voice.say_and_print("Message sent successfully!")
                del msg
                s.quit()
                return
            else:
                the_voice.say_and_print("just say 'yes', 'no' or 'cancel'!")
                continue
예제 #9
0
def update_sender():
    while 1:
        the_voice.say_and_print("Name the sender or say \"CANCEL\" to cancel")
        name = the_voice.listening()
        while 1:
            try:
                name = name.lower()
                if name == "cancel":
                    return
                break
            except:
                print("Name the sender or say \"CANCEL\" to cancel")
            name = the_voice.listening()

        decrypt('data_files/sender.txt', key)
        with open('data_files/sender.txt', mode='r', encoding='utf-8') as open_sender:
            flag = 0
            for senders in open_sender:
                if name.lower() == senders.split()[0].lower().rstrip():
                    flag = 1
                    BY = senders.split()[1].lower().rstrip()
                    print("Information encrypted!")
                    try:
                        s.login(BY, senders.split()[2].lower().rstrip())
                        the_voice.say_and_print("Login successful!")
                    except Exception as e:
                        print("Something is wrong with sender credentials or account access settings!")
                        print(e)
                        return 1
                    send(BY, key)
                    break
            encrypt('data_files/sender.txt', key)
            if flag == 0:
                the_voice.say_and_print("This person is not in your sender's list!")
                while 1:
                    the_voice.say_and_print("Add this person in senders list, yes or no? Or say \"CANCEL\" to cancel.")
                    flag = the_voice.listening()
                    if type(flag) == type("abc"):
                        if flag.lower() == 'yes':
                            decrypt('data_files/sender.txt', key)
                            with open('data_files/sender.txt', mode='a', encoding='utf-8') as sender:
                                while 1:
                                    the_voice.say_and_print("Enter sender's email address or \"CANCEL\" to cancel.")
                                    while 1:
                                        BY = input(">>>")
                                        try:
                                            BY = BY.lower()
                                            if BY == "cancel":
                                                encrypt('data_files/sender.txt', key)
                                                return
                                            break
                                        except:
                                            print("Sender's email address can't be empty!")
                                            print("Enter email or \"CANCEL\" to cancel.")
                                    if '@' in BY and '.' in BY:
                                        the_voice.say_and_print("Enter password or \"CANCEL\" to cancel.")
                                        PassWord = input(">>>")
                                        while 1:
                                            try:
                                                PassWord = PassWord.lower()
                                                if PassWord == "cancel":
                                                    encrypt('data_files/sender.txt', key)
                                                    return
                                                break
                                            except:
                                                the_voice.say_and_print("Enter password or \"CANCEL\" to cancel.")
                                            PassWord = input(">>>")
                                        L = [" \n", name, " ", BY, " ", PassWord]
                                        sender.writelines(L)

                                        the_voice.say_and_print("Sender is added successfully")
                                        send(BY, key)
                                        while 1:
                                            the_voice.say_and_print(
                                                "Continue messaging from this sender, yes or no? Or say \"CANCEL\" to cancel.")
                                            flag2 = the_voice.listening()
                                            while 1:
                                                try:
                                                    flag2 = flag2.lower()
                                                    if flag2 == "cancel":
                                                        encrypt('data_files/sender.txt', key)
                                                        return
                                                    break
                                                except:
                                                    print("Say yes , no or \"CANCEL\" to cancel.")
                                                flag2 = the_voice.listening()
                                            if flag2 == 'yes':
                                                the_voice.say_and_print("Okay!")
                                                send(BY, key)
                                            elif flag2 == 'no':
                                                the_voice.say_and_print("Okay!")
                                                break
                                            else:
                                                the_voice.say_and_print("Try again!")
                                                continue
                                        break
                                    else:
                                        the_voice.say_and_print("Wrong gmail format!")
                                        the_voice.say_and_print("try again...")
                                        continue
                            encrypt('data_files/sender.txt', key)
                            break
                        elif flag.lower() == 'no':
                            break
                        else:
                            the_voice.say_and_print("Wrong input try again")
                    else:
                        the_voice.say_and_print("Try again...")
                        continue
예제 #10
0
def start(cmd):
    if "find meaning" in cmd or ("tell" in cmd and "meaning" in cmd) or ("find" in cmd and "meaning" in cmd):
        the_voice.say_and_print("Say the word to get meaning")
        a = the_voice.listening()
        if a is None:
            print("Sorry, didn't get you!")
            print("Please say the name of file to search, or \"CANCEL\" to cancel")
            while a is not None:
                a = the_voice.listening()
                a = a.lower()
                if a == "cancel":
                    return 1
        a = a.lower()
        the_voice.say_and_print("Finding meaning...")
        tell_meaning.meaning(a)
        return 1

    elif "search google" in cmd or "find on google" in cmd or ("search" in cmd and "net" in cmd) or (
            "search" in cmd and "google" in cmd):
        the_voice.say_and_print("What do you want to search?")
        a = the_voice.listening()
        if a is None:
            print("Sorry, didn't get you!")
            print("Please say the name of file to search, or \"CANCEL\" to cancel")
            while a is not None:
                a = the_voice.listening()
                a = a.lower()
                if a == "cancel":
                    return 1
        a = a.lower()
        the_voice.say_and_print("Searching...")
        google_search.search(a)
        return 1

    elif "open site" in cmd or ("open" in cmd and "site" in cmd):
        the_voice.say_and_print("which site do you want to open?")
        a = the_voice.listening()
        if a is None:
            print("Sorry, didn't get you!")
            print("Please say the name of file to search, or \"CANCEL\" to cancel")
            while a is not None:
                a = the_voice.listening()
                a = a.lower()
                if a == "cancel":
                    return 1
        a = a.lower()
        the_voice.say_and_print("Opening Site...")
        frequent_site.site(a)
        return 1
    elif "set reminder" in cmd or ("set" in cmd and "reminder" in cmd):
        the_voice.say_and_print("What shall I remind you about?")
        a = the_voice.listening()
        if a is None:
            print("Sorry, didn't get you!")
            print("Please say the name of file to search, or \"CANCEL\" to cancel")
            while a is not None:
                a = the_voice.listening()
                a = a.lower()
                if a == "cancel":
                    return 1
        a = a.lower()
        the_voice.say_and_print("Setting reminder...")
        the_voice.say_and_print("In how many seconds you want to be reminded?")
        while True:
            temp = the_voice.listening()
            try:
                b = int(temp)
                break
            except:
                if temp.lower() == "cancel":
                    return 1
                the_voice.say_and_print("Please tell after how many seconds you want to be reminded, or say \"CANCEL\" to cancel")
        set_reminder.task(a, b)
        return 1

    elif "movies nearby" in cmd or "search movies" in cmd or ("movies" in cmd and "nearby" in cmd) or (
            "search" in cmd and "movies" in cmd):
        the_voice.say_and_print("Showing Movies Near by...")
        movies_nearby.movies("movies nearby")
        return 1

    elif "plan travel" in cmd or ("plan" in cmd and "travel" in cmd) or ("book" in cmd and "hotel" in cmd) or (
            "book" in cmd and "flight" in cmd) or ("book" in cmd and "train" in cmd) or (
            "book" in cmd and "bus" in cmd):
        the_voice.say_and_print("Plan Your Travel")
        plan_travel.travel()
        return 1

    elif "latest updates" in cmd or ("latest" in cmd and "updates" in cmd) or ("tell" in cmd and "news" in cmd):
        the_voice.say_and_print("Showing Latest Feeds...")
        news_update.news()
        return 1

    elif "cricket score" in cmd or ("cricket" in cmd and "score" in cmd) or ("live" in cmd and "cricket" in cmd):
        the_voice.say_and_print("Showing Cricket Score...")
        cricket_score.score()
        return 1

    return 0
def start():
    encryptor_decryptor.safe_key_generator()
    key = encryptor_decryptor.load_key()
    while 1:
        the_voice.say_and_print("Who is the receiver?")
        while True:
            name = the_voice.listening()
            try:
                name = name.lower()
                if name == "cancel":
                    return
                break
            except:
                print(
                    "Sorry didn't get you, please tell the name or \"CANCEL\" to cancel"
                )
        print("Receiver:", name)
        decrypt('data_files/phone_book.txt', key)
        with open('data_files/phone_book.txt', mode='r',
                  encoding='utf-8') as contacts_file:
            flag = 0
            for contacts in contacts_file:
                name2 = contacts.split()[0]
                name2 = name2.lower()
                if name2 == name:
                    flag = 1
                    RECEIVER = contacts.split()[1]
                    RECEIVER = RECEIVER.rstrip()
                    print("sending to: ", RECEIVER)
                    encrypt('data_files/phone_book.txt', key)
                    send(RECEIVER, key)
        if flag == 0:
            the_voice.say_and_print("Given name is not in your contact list!")
            while 1:
                the_voice.say_and_print(
                    "Enter this in contact list, yes or no?")
                flag = the_voice.listening()
                try:
                    flag = flag.lower()
                    if flag == 'yes':
                        add_contact(name, key)
                        break
                    elif flag == 'no':
                        break
                    else:
                        the_voice.say_and_print("Please say Yes or No!")
                except:
                    print("Sorry, didn't get what you said, please try again")

            the_voice.say_and_print("Send again, yes or no?")

        while True:
            flag3 = the_voice.listening()
            try:
                flag3 = flag3.lower()
                if flag3 == 'yes':
                    break
                elif flag3 == 'no':
                    return
                else:
                    the_voice.say_and_print("Please say Yes or No!")
            except:
                print("Sorry, didn't get what you said, please try again")
def send(RECEIVER, key):
    decrypt('data_files/sid-token.txt', key)
    with open('data_files/sid-token.txt', mode='r', encoding='utf-8') as id:
        for items in id:
            account_sid = items.split()[0]
            auth_token = items.split()[1]
    encrypt('data_files/sid-token.txt', key)

    client = Client(account_sid, auth_token)
    while True:
        the_voice.say_and_print("Enter message:")
        waap_message = the_voice.listening()
        while True:
            try:
                waap_message.lower()
                break
            except:
                print("Sorry didn't get you, please say again!")
            waap_message = the_voice.listening()
        print("Send?(yes/no)")
        the_voice.say("Send, yes or no")
        while 1:
            flag = the_voice.listening()
            try:
                flag = flag.lower()
                if flag == 'yes':
                    the_voice.say_and_print("Sending...")
                    break
                elif flag == 'no':
                    break
                else:
                    the_voice.say_and_print("Please say Yes or No!")
            except:
                print("Sorry didn't get what you said, please say again")
        if flag == 'yes':
            decrypt('data_files/sid-token.txt', key)
            with open('data_files/sid-token.txt', mode='r',
                      encoding='utf-8') as id:
                for items in id:
                    sandbox_number = items.split()[2]
            encrypt('data_files/sid-token.txt', key)
            try:
                message = client.messages.create(from_='whatsapp:' +
                                                 sandbox_number,
                                                 body=waap_message,
                                                 to='whatsapp:' + RECEIVER)
                print(message)
                the_voice.say_and_print("Message sent successfully!")
            except Exception as e:
                print(e)
                print("Message not send!")
            return
        elif flag == 'no':
            the_voice.say_and_print(
                "Do you wish to \"EDIT\" the message, or \"CANCEL\"")
            while True:
                ch = the_voice.listening()
                try:
                    ch = ch.lower()
                    if "edit" in ch:
                        break
                    elif "cancel" in ch:
                        return
                    else:
                        print("Please say \"EDIT\" or \"CANCEL\"")
                except:
                    print(
                        "Sorry, didn't get you please say \"EDIT\" or \"CANCEL\""
                    )