Exemple #1
0
 def doSomething(self, payLoad):
     adapter.addPet(payLoad['user'], 'snekpets')
     sqlResults = adapter.getPets()
     if not utils.validPayload(payLoad):
         directResponse(payLoad, words.textBadReport)
         return 
     response = utils.parsePets(sqlResults)
     directResponse(payLoad, response)
     return
Exemple #2
0
    def doSomething(self, payLoad):
        text = payLoad['text']
        try:
            date = utils.dateExtractor(utils.ONE_DATE, text)
            if date is None:
                return
            sqlResults = adapter.singleDayReport(date)
            if not utils.validPayload(payLoad):
                directResponse(payLoad, words.textBadReport)
                return 
            totalReports = adapter.reportCount(date, date)
            response = utils.parseSingleDayReport(sqlResults, date, totalReports) # parse the payload
        except:
            return

        directResponse(payLoad, response)
        return
Exemple #3
0
    def doSomething(self, payLoad):
        text = payLoad['text']
        try:
            dateBlock = utils.dateExtractor(utils.DATE_RANGE, text)
            if dateBlock is None:
                return

            date1, date2 = utils.dateSplitter(dateBlock)
            totalReports = adapter.reportCount(date1, date2)            
            sqlResults = adapter.garyReport(date1, date2)
            if not utils.validPayload(payLoad):
                directResponse(payLoad, words.textBadReport)
                return 
            
            response = utils.parseGaryReport(sqlResults, date1, date2, totalReports) # parse the payload
        except Exception as e:
            print(e)
            return

        directResponse(payLoad, response)
        return