Advertisement
Guest User

Untitled

a guest
Feb 21st, 2019
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. cnx = connector.connect(host='I_really_don_t_know_what_to_use_here', password='your_password', user="your_user", database="the_database")
  2.  
  3. class ActionBookRoom(Action):
  4. def name(self):
  5. return 'action_room'
  6.  
  7. def run(self, dispatcher, tracker, domain):
  8. print("inside run")
  9. name_room = tracker.get_slot('name_room')
  10. day = tracker.get_slot('day')
  11. hour_start = tracker.get_slot('hour_start')
  12. duration = tracker.get_slot('duration')
  13.  
  14. booking_answer = make_a_booking(name_room, day, hour_start, duration)
  15. print("passed booking")
  16. if booking_answer:
  17. booking_answer = 'The reservation has been made'
  18. else:
  19. booking_answer = 'The room is taken at this hour'
  20.  
  21. response = """You want to book the {} room on {} at {} for {}. Is it correct ?""".format(name_room, day, hour_start, duration)
  22.  
  23. name_room = str(name_room)
  24. day = str(day)
  25. hour_start = str(hour_start)
  26. duration = str(duration)
  27. print("before connexion")
  28. #SQL queries#
  29. cnx = connector.connect(host='I_really_don_t_know_what_to_use_here', password='your_password', user="your_user", database="the_database")
  30. print("after connexion")
  31.  
  32. dispatch = dispatcher.utter_message(response)
  33. dispatch = dispatcher.utter_message(str(booking_answer))
  34.  
  35. return dispatch
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement