def reward_author(ctx, author, url, percentage=50, memo="", debug=False): """ claim all the tokens of an account""" settings.set_steem_node() bot = TransferBot() bot.send_author_rewards(author, url, percentage, memo)
def all_tokens(ctx, account, debug=False): """ claim all the tokens of an account""" settings.set_steem_node() bot = ClaimBot() bot.claim_all_scot_tokens(account)
def all_users(ctx, debug=False): """ claim all the tokens of all accounts""" settings.set_steem_node() bot = ClaimBot() bot.claim_all_accounts()
def _read_comments(self): if len(self.comments) == 0: # settings.set_steem_node(STEEM_API_NODES[1], overwrite=True) self.comments = get_comments(self.author) settings.set_steem_node(CURRENT_API_NODE, overwrite=True, condenser=False) return self.comments
def estimate_value(ctx, account, token, weight=100, debug=False): """ estimate the vote value of account """ if debug: settings.set_debug_mode() settings.set_steem_node() print(Voter(account).estimate_vote_value_for_token(token, weight))
def estimate_weight(ctx, account, token, value, debug=False): """ estimate the needed weight to reach the vote value """ if debug: settings.set_debug_mode() settings.set_steem_node() weight = Voter(account).estimate_vote_pct_for_token(token, float(value)) print("{}%".format(round(weight, 2)))
def fetch_posts(self, days): settings.set_hive_node() posts = query({ "mode": "post", "account": self.account, "days": days }) settings.set_steem_node() return posts
def vote(ctx, url, debug=False): """ vote a post by cn-hello """ if debug: settings.set_debug_mode() settings.set_steem_node() bot = CnHelloBot() bot.vote(url=url)
def vote(ctx, recipe=None, debug=False): """ run a specific vote recipe""" # if debug: # settings.set_debug_mode() settings.set_steem_node() cookbook = VoteCookbook() cookbook.cook(recipe)
def daily_stats(ctx, tag="cn", days=7.0, debug=False): """ publish summary post for daily and weekly update """ if debug: settings.set_debug_mode() settings.set_steem_node(STEEM_API_NODES[4], condenser=True) bot = CnHelloBot(tag=tag, days=days) bot.publish_daily_stats()
def votes(ctx, author=None, debug=False): """ vote a specific comment""" # if debug: # settings.set_debug_mode() settings.set_steem_node() bot = InfoBot("null") print(bot.get_votes([author]))
def comment(ctx, url=None, debug=False): """ vote a specific comment""" # if debug: # settings.set_debug_mode() settings.set_steem_node() bot = VoteBot() bot.vote(url=url)
def info(ctx, recipe=None, debug=False): """ run a specific info recipe""" # if debug: # settings.set_debug_mode() settings.set_steem_node() cookbook = InfoCookbook() cookbook.cook(recipe)
def reply(ctx, url, message_id="welcome", debug=False): """ reply to a post by cn-hello """ if debug: settings.set_debug_mode() settings.set_steem_node() bot = CnHelloBot() bot.reply(url=url, message_id=message_id)
def get_payout(ctx, url, debug=False): """ get the payout value of a post """ settings.set_steem_node() bot = TransferBot() payout = bot.get_post_payout(url=url) for token in payout: print(token, ":") reward = payout[token] for k, v in reward.items(): print(k, ":", v)
def _has_published(self, title, keyword): settings.set_steem_node(CURRENT_API_NODE, overwrite=True, condenser=True) posts = get_posts(account=self.author, keyword=keyword, limit=10) settings.set_steem_node(CURRENT_API_NODE, overwrite=True, condenser=False) if len(posts) > 0: for post in posts: if post.title == title: return True return False
def token(ctx, account, token=None, debug=False): """ claim a specific token""" # if debug: # settings.set_debug_mode() settings.set_steem_node() bot = ClaimBot() if not token: bot.claim_all_scot_tokens(account) else: bot.claim_scot_token(account, token)
def welcome(ctx, tag="cn", days=3.0, debug=False): """ send welcome messages to newbies """ if debug: settings.set_debug_mode() settings.set_steem_node() bot = CnHelloBot(tag=tag, days=days) posts = bot.welcome_all() if len(posts) > 0: filename = bot.write_posts() bot.send_notification()
def list_posts(ctx, account=None, tag=None, keyword=None, limit=None, days=None, debug=False): """ list the post by account, tag, keyword, etc. """ if debug: settings.set_debug_mode() settings.set_steem_node() get_posts(account, tag, keyword, limit, days)
def stream_posts(ctx, account=None, tag=None, keyword=None, limit=None, days=None, debug=False): """ stream the post by account, tag, keyword, etc. """ if debug: settings.set_debug_mode() settings.set_steem_node() monitor_posts()
def search(ctx, tag="cn", days=3.0, debug=False): """ search the latest posts by newbies""" if debug: settings.set_debug_mode() settings.set_steem_node() bot = CnHelloBot(tag=tag, days=days) posts = bot.get_latest_posts() if len(posts) > 0: filename = bot.write_posts() bot.list_newbies() bot.send_notification()
def weekly_stats(ctx, tag="cn", days=7.0, debug=False): """ publish weekly stats of cn-hello """ if debug: settings.set_debug_mode() settings.set_steem_node(STEEM_API_NODES[4], condenser=True) day_of_the_week = datetime.datetime.today().weekday() # only Sunday if day_of_the_week == 6: logger.info("Create the weekly summary") bot = CnHelloBot(tag=tag, days=days) bot.publish_weekly_stats() else: logger.info("Skip the weekly summary until its Sunday")
def download(ctx, account=None, tag=None, days=None, host="github", debug=False, clear=False, production=False): """ download the posts to local by the account """ if debug: settings.set_debug_mode() if clear: clean(ctx) settings.set_steem_node() account = account or settings.get_env_var("STEEM_ACCOUNT") tag = tag or settings.get_env_var("STEEM_TAG") days = days or settings.get_env_var("DURATION") clean_build = settings.get_env_var("CLEAN_BUILD") if clean_build and clean_build.lower() == "true": clean_build = True else: clean_build = False if clean_build: incremental = False else: incremental = production builder = BlogBuilder(account=account, tag=tag, days=days, host=host) if production and not clean_build: builder.set_smart_duration() builder.update_config(incremental=incremental) count = builder.download() if production: builder.update_workspace() if incremental: if production and count > 0: count = len(builder.list_new_posts()) else: count = len(builder.list_all_posts()) return count
def generate(ctx, account="teamcn-shop", tag=None, days=None, debug=False, production=False): """ generate the roster from the specified sources """ if debug: settings.set_debug_mode() settings.set_steem_node() account = account or settings.get_env_var("STEEM_ACCOUNT") tag = tag or settings.get_env_var("STEEM_TAG") days = days or settings.get_env_var("DURATION") incremental = settings.get_env_var("INCREMENTAL") or False crawler = RosterBuilder(account=account, tag=tag, days=days, incremental=incremental) crawler.crawl() return crawler.build()