I am creating a restaurant bot in which the user is asked to pay or order more, when the user picks order more it repeats part of the story that displays the restaurant menu category and then chooses the dish he/she wants. My problem is that the button should set two slots; a list and a normal slot. This is my code:
######ACTION######
i=1 buttons = [] for restaurant_menu_category_en in all_restaurant_menu_categories_en: title = str(i) + "- "+ restaurant_menu_category_en[1] +"\n" payload = "/ask_chosen_restaurant_menu_category_en{\"chosen_restaurant_menu_category_en\":\"" + restaurant_menu_category_en[1] + "\",\"chosen_restaurant_menu_category_list_en\":\"" + tracker.get_slot('chosen_restaurant_menu_category_list_en').append(restaurant_menu_category_en[1]) + "\"}" i+=1 buttons.append({"title": title,"payload": payload}) dispatcher.utter_message(buttons=buttons)
######DOMAIN######
###Slots###
chosen_restaurant_menu_category_en: type: text influence_conversation: false chosen_restaurant_menu_category_list_en: type: list initial_value: [] influence_conversation: true
#####STORY#####
- intent: ask_chosen_restaurant_menu_category_en entities:
- chosen_restaurant_menu_category_en: sandwich
- slot_was_set:
- chosen_restaurant_menu_category_en: sandwich
- slot_was_set:
- chosen_restaurant_menu_category_list_en: []
My problem is that when I run the code I get the following
error: TypeError: can only concatenate str (not “NoneType”) to str
for this line: payload =
“/ask_chosen_restaurant_menu_category_en{“chosen_restaurant_menu_category_en”:”" + restaurant_menu_category_en[1] + “”,“chosen_restaurant_menu_category_list_en”:"" + tracker.get_slot(‘chosen_restaurant_menu_category_list_en’).append(restaurant_menu_category_en[1]) + “”}"
How can I append the payload value to a list?