Пример #1
0
    def submit(
        self,
        dispatcher: CollectingDispatcher,
        tracker: Tracker,
        domain: Dict[Text, Any],
    ) -> List[EventType]:
        """Once we have all the information, attempt to add it to the
        Google Drive database"""

        import datetime

        budget = tracker.get_slot("budget")
        company = tracker.get_slot("company")
        email = tracker.get_slot("business_email")
        job_function = tracker.get_slot("job_function")
        person_name = tracker.get_slot("person_name")
        use_case = tracker.get_slot("use_case")
        date = datetime.datetime.now().strftime("%d/%m/%Y")

        sales_info = [company, use_case, budget, date, person_name, job_function, email]

        try:
            gdrive = GDriveService()
            gdrive.store_data(sales_info)
            dispatcher.utter_message(template="utter_confirm_salesrequest")
            return []
        except Exception as e:
            logger.error(
                "Failed to write data to gdocs. Error: {}" "".format(e.message),
                exc_info=True,
            )
            dispatcher.utter_message(template="utter_salesrequest_failed")
            return []
Пример #2
0
    def submit(self,
               dispatcher: CollectingDispatcher,
               tracker: Tracker,
               domain: Dict[Text, Any]) -> List[Dict]:
        """Once we have all the information, attempt to add it to the
        Google Drive database"""

        import datetime
        budget = tracker.get_slot('budget')
        company = tracker.get_slot('company')
        email = tracker.get_slot('business_email')
        job_function = tracker.get_slot('job_function')
        person_name = tracker.get_slot('person_name')
        use_case = tracker.get_slot('use_case')
        date = datetime.datetime.now().strftime("%d/%m/%Y")

        sales_info = [company, use_case, budget, date, person_name,
                      job_function, email]

        gdrive = GDriveService()
        try:
            gdrive.store_data(sales_info)
            dispatcher.utter_template('utter_confirm_salesrequest', tracker)
            return []
        except Exception as e:
            logger.error("Failed to write data to gdocs. Error: {}"
                         "".format(e.message), exc_info=True)
            dispatcher.utter_template('utter_salesrequest_failed', tracker)
            return []
Пример #3
0
    def run(self, dispatcher, tracker, domain):
        import datetime
        countTime = tracker.get_slot('countTime')
        peopleCount = tracker.get_slot('peopleCount')
        vehicleCount = tracker.get_slot('vehicleCount')
        trailVisits = tracker.get_slot('trailVisits')
        returnStatus = tracker.get_slot('returnStatus')
        infoSource = tracker.get_slot('infoSource')
        zipCode = tracker.get_slot('zipCode')
        yearBorn = tracker.get_slot('yearBorn')

        date_cur = datetime.datetime.now().strftime("%d/%m/%Y")

        time = [
            data_cur, countTime, peopleCount, vehicleCount, trailVisits,
            returnStatus, infoSource, zipCode, yearBorn
        ]

        gdrive = GDriveService()
        try:
            gdrive.store_data(sales_info)
            return [SlotSet('data_stored', True)]
        except Exception as e:
            logger.error("Failed to write data to gdocs. Error: {}"
                         "".format(e.message),
                         exc_info=True)
            return [SlotSet('data_stored', False)]
Пример #4
0
    def run(self, dispatcher, tracker, domain):
        import datetime
        budget = tracker.get_slot('budget')
        company = tracker.get_slot('company_name')
        email = tracker.get_slot('email')
        jobfunction = tracker.get_slot('job_function')
        name = tracker.get_slot('person_name')
        use_case = tracker.get_slot('use_case')
        date = datetime.datetime.now().strftime("%d/%m/%Y")

        sales_info = [company, use_case, budget, date, name, jobfunction,
                      email]

        gdrive = GDriveService()
        try:
            gdrive.store_data(sales_info)
            return [SlotSet('data_stored', True)]
        except Exception as e:
            logger.error("Failed to write data to gdocs. Error: {}"
                         "".format(e.message), exc_info=True)
            return [SlotSet('data_stored', False)]