def includePrivate(self, entry, twitter): rank = int(entry['rank']) if (rank < self.board.entriesToPrivateReportOnRankDiff() or rank < self.board.entriesToPrivateReportOnPointsDiff()): if 'twitter_username' in entry and entry[ 'twitter_username'] != None and entry[ 'twitter_username'] != '': return True twitterHandle = nsb_steam.getTwitterHandle(entry['steam_id'], twitter) if twitterHandle != None: #print('handle:', twitterHandle) entry['twitter_username'] = twitterHandle return True return False
def composeDailyMessage(persons, board, twitter): namescore_list = [] for person in persons: twitterHandle = nsb_steam.getTwitterHandle(person['steam_id'], twitter) if twitterHandle: name = '@' + twitterHandle else: name = nsb_steam.steamname(int(person['steam_id']), options['steam_key']) namescore_list.append(str(name) + ' (' + str(person['points']) + ')') namescores_string = ', '.join(map(str, namescore_list)) date_string = board.board._date.strftime("%b%d") url = board.getUrl() tag = '#necrodancer' return ' '.join( map(str, [ "Top scores for", date_string, "Daily:", namescores_string, url, tag ]))
def getTwitterHandle(self, person, twitter): return nsb_steam.getTwitterHandle(int(person['steam_id']), twitter)