Ejemplo n.º 1
0
 def update_token(self, auth_response):
     database = Database()
     database.initialize()
     self.access_token = auth_response['bot']['bot_access_token']
     self.team_id = auth_response['team_id']
     self.user_id = auth_response['user_id']
     numbers = re.compile('\d+(?:\.\d+)?')
     max_age = int(
         numbers.findall(
             auth_response['headers']['Strict-Transport-Security'])[0])
     self.token_expiry_time = int(time.time()) + max_age
     database.update(collection="slack_tokens",
                     query=({
                         "team_id": self.team_id,
                         "user_id": self.user_id
                     }),
                     update=self.json())
Ejemplo n.º 2
0
 def update_user(self, update):
     database = Database()
     database.initialize()
     database.update("users", {"_id": self._id}, update)
     print("User successfully updated")
Ejemplo n.º 3
0
 def add_to_send_count(self):
     database = Database()
     database.initialize()
     self.send_count += 1
     database.update("users", {"_id": self._id}, self.json())