def wake_function(frame, text, token):
    frame.assistant_speaks("Zadanie o jakim numerze zrobiłeś?")
    task_id = get_audio(5)
    while task_id == "":
        frame.assistant_doesnt_understand()
        task_id = get_audio(5)
    frame.user_speaks(task_id)
    frame.assistant_speaks(mark_task_as_done(token, int(task_id)))
Exemple #2
0
def wake_function(frame, text, token):
    frame.assistant_speaks("Wiadomość o jakim numerzę przeczytałeś?")
    message_id = get_audio(5)
    while message_id == "":
        frame.assistant_doesnt_understand()
        message_id = get_audio(5)
    frame.user_speaks(message_id)
    frame.assistant_speaks(mark_message_as_read(token, int(message_id)))
def wake_function(frame, *rest):
    frame.assistant_speaks("Podaj kraj dla którego chciałbyś otrzymać informacje ?")
    time.sleep(1.5)
    country_name = get_audio(5)
    while country_name == "":
        frame.assistant_doesnt_understand()
        country_name = get_audio(5)
    frame.user_speaks(country_name)
    frame.assistant_speaks(get_covid_data(country_name))
def wake_function(frame, text, token):
    frame.assistant_speaks("Podaj nazwę wydarzenia")
    name = get_audio(5)
    while name == "":
        frame.assistant_doesnt_understand()
        name = get_audio(5)
    frame.user_speaks(name)
    frame.assistant_speaks("Podaj date(w formacie: dzień miesiąc rok czas)")
    date = get_audio(5)
    while date == "":
        frame.assistant_doesnt_understand()
        date = get_audio(5)
    frame.user_speaks(date)
    frame.assistant_speaks(add_event(name, date, token))
def wake_function(frame, text, token):
    frame.assistant_speaks("Do kogo chcesz wysłać wiadomość")
    receiver = get_audio(5)
    while receiver == "":
        frame.assistant_doesnt_understand()
        receiver = get_audio(5)
    frame.user_speaks(receiver)
    frame.assistant_speaks("Podaj wiadomość: ")
    content = get_audio(5)
    while content == "":
        frame.assistant_doesnt_understand()
        content = get_audio(5)
    frame.user_speaks(content)
    frame.assistant_speaks(send_message(receiver.lower(), content, token))
def start_listening(frame, token):
    wake = "Janusz"
    try:
        services, last_service = service.create_services()
    except AttributeError:
        time.sleep(3)
        frame.assistant_speaks("Jeden z dodanych serwisów, nie ma zdefiniowanych wymaganych funkcji. "
                             "Aby korzystać z asystenta napraw ten błąd.")
        time.sleep(11)
        frame.quit()
        return
    except ValueError as e:
        time.sleep(3)
        frame.assistant_speaks(str(e))
        time.sleep(11)
        frame.quit()
        return

    while True:
        text = get_audio(2)
        
        if text.count(wake) > 0:
            frame.assistant_listening()
            text = get_audio(5)
            while text == "":
                frame.assistant_doesnt_understand()
                text = get_audio(5)
            frame.user_speaks(text)
            old_text = text
            text = text.lower()
            try:
                for index, s in enumerate(services):
                    if should_wake(s.wake_words, text):
                        s.wake_function(frame, text, token)
                        break
                    if index + 1 == len(services) and last_service is not None:
                        last_service.wake_function(frame, old_text, token)

            except Exception as e:
                print(e)
                pass