def _get_daily_blog_body(self, message_id): delta = 0.05 daily_replies = self._get_replies("welcome", 1.0 - delta) # 1 days weekly_replies = self._get_replies("welcome", 7.0 - delta) # 7 days daily_total = len(daily_replies) weekly_total = len(weekly_replies) articles = [ ("@{}".format(r['receiver']), "<a href=\"{}\">{}</a>".format(self._get_accessible_url(r['url']), r['title'])) for r in daily_replies ] articles_table = build_table(["作者", "文章"], articles) stats = [] for r in weekly_replies: author = r['receiver'] account = SteemAccount(author) steemd_link = "{}/@{}".format(STEEMD_HOST, author) row = ("@{}".format(author), round(account.age_in_days(), 1), round(account.reputation(), 1), "<a href=\"{}\">{}%</a>".format( steemd_link, round(account.rc_percentage(), 1)), round(account.steem_power(), 1), account.follower_count(), account.post_count()) stats.append(row) stats = sorted(stats, key=(lambda row: row[1]), reverse=False) stats_table = build_table( ["新人", "天数", "声望", "活动能量", "Steem Power", "粉丝数", "发帖数"], stats) return get_message(message_id).format(daily_total=daily_total, weekly_total=weekly_total, articles_table=articles_table, stats_table=stats_table)
def who_to_vote(self, author): if author in BLACKLIST: logger.info("Skip [{}] who is in my blacklist".format(author)) return False account = SteemAccount(author) if account.reputation() < ACCOUNT_REPUTATION_THRESHOLD: logger.info("Skip [{}] whose reputation is too low".format(author)) return False if self.authors.get(author) is None: self.authors[author] = 1 self.posts_num += 1 return True elif self.authors.get(author) < VOTE_PER_ACCOUNT_LIMIT: self.authors[author] += 1 self.posts_num += 1 return True elif self.authors.get(author) >= VOTE_PER_ACCOUNT_LIMIT: return False return False