def run_method(self): ''' The method on which the thread will run ''' first = True while(self.alive): # Get the latest few donations redis = AlerterRedis() latest = Donation.fetch(5, self.user.twitchalertskey) for new in latest: donate_id = new['id'] # Store the overnight donations in the redis server if first: redis.new_donation(self.user, donate_id) continue if (not redis.has_donation(self.user, donate_id)): redis.new_donation(self.user, donate_id) if(self.user.minimumdonation != None and float(new['amount']) < self.user.minimumdonation): continue self.active_user.new_donation(new['donator']['name'], new['amount'], new['message']) first = False # Minimum cache time by TwitchAlerts time.sleep(20)
def run_method(self): ''' The method on which the thread will run ''' first = True while (self.alive): # Get the latest few donations redis = AlerterRedis() latest = Donation.fetch(5, self.user.twitchalertskey) for new in latest: donate_id = new['id'] # Store the overnight donations in the redis server if first: redis.new_donation(self.user, donate_id) continue if (not redis.has_donation(self.user, donate_id)): redis.new_donation(self.user, donate_id) if (self.user.minimumdonation != None and float(new['amount']) < self.user.minimumdonation): continue self.active_user.new_donation(new['donator']['name'], new['amount'], new['message']) first = False # Minimum cache time by TwitchAlerts time.sleep(20)