def search_category(search_category): speech = "Ok, you chose {} right?".format(search_category) context_manager.add('search_context', lifespan=3) context_manager.set('search_context', 'search_category', search_category) return ask(speech)
def departure_date(day): context_manager.set('departure', 'day', day) context_manager.add('arrival') speech = 'Ok would you like to confrim your booking details?' return ask(speech)
def action_func(stores): manager.get('data').set('stores', stores) manager.add('stores-selected') return event('SelectMeasureType')
def add_context(): speech = "Adding context to context_out" manager.add("context_1") return ask(speech)
def store_answer(answer): manager.add('time-periods-complete') # always end with day manager.get('data').set('byday', answer) return event('AskProductScope')
def action_func(products): manager.get('data').set('products', products) manager.add('products-selected') return event('SelectMeasureType')
def display_available_strats(): context_manager.add("strat-config-data") resp = inline_keyboard("Which strategy do you wish to try?") for i in build.EXISTING_STRATS: resp.add_button(*i) return resp
def start_conversation(search_category): context_manager.add('search_context', lifespan=5) context_manager.set('search_context', 'search_category', search_category) return ask("Hello shopper!, you looking for {} right?".format( search_category)).suggest('yes', 'no')
def set_special_choice(specialty): speech = 'Cool, you chose a {} pizza. What size do you want?'.format( specialty) context_manager.add('special').set('specialty', specialty) return ask(speech)
def make_sure(order_method): context_manager.add(order_method) speech = "Did you say {}?".format(order_method) return ask(speech)
def greetings(): speech = """We've got some bumpin pies up in here!. Would you like to order for pickup or delivery?""" context_manager.add('select-method', lifespan=1) return ask(speech)
def search_category(search_category): context_manager.add('search_context', lifespan=5) context_manager.set('search_context', 'search_category', search_category) return ask( "OK, you looking for {} right?".format(search_category)).suggest( 'yes', 'no')
def restart_conversation(): context_manager.add('search_context', lifespan=0) # context_manager.add('search_results', lifespan=0) return ask('OK! New search').suggest('I want new smartphone', 'I am looking for a laptop', 'Looking for bike')
def set_user_diet(diet): speech = 'Are you trying to make food or get food?' manager.add(diet) return ask(speech)
def store_answer(answer): manager.add('ask-byday', lifespan=1) manager.get('data').set('byweek', answer) return event('StepToProducts')
def add_context(): speech = 'Adding context to context_out' manager.add('SampleContext') return ask(speech)
def start_allergies(): context_manager.add('await_for_food', lifespan=10) speech = "sure, what is your allergy?" return ask(speech)