def update_user(self, user: User):
     with self.c:
         cursor = self.c.cursor()
         cursor.execute(
             f'UPDATE users '
             f'SET telegram_id = ?, balance = ?, is_follower = ?, invited_by = ? '
             f'WHERE telegram_id = {user.telegram_id}', user.list_for_db())
         self.c.commit()
 def add_user(self, user: User):
     with self.c:
         cursor = self.c.cursor()
         if self.get_user_by_telegram_id(
                 telegram_id=user.telegram_id) is None:
             sql = f'INSERT INTO users(telegram_id, balance, is_follower, invited_by) VALUES(?,?,?,?)'
             cursor.execute(sql, user.list_for_db())
             self.c.commit()
         else:
             print('User already exists')