def worker(worker_comment):
time.sleep(vote_delay)
try:
for (k, v) in enumerate(account):
worker_steem = Steem(keys=posting_key)
upvote_comment = worker_steem.get_content(worker_comment.identifier)
# Checking if Post is flagged for Plagarism & Spam
names = ['blacklist', 'fubar-bdhr']
if ('-' in str(upvote_comment['author_reputation'])):
print("@%s %s ====> Upvote Skipped - Author rep too low")
return False
for avote in upvote_comment['active_votes']:
if (avote['voter'] in names and avote['percent'] < 0):
print("@%s %s ====> Upvote Skipped - Flagged by blacklist or Fubar-bdhr")
return False
# Checking if there is markings from Cheetah or Steemcleaners:
names = ['cheetah', 'steemcleaners']
for avote in upvote_comment['active_votes']:
if (avote['voter'] in names):
print("@%s %s ====> Post Marked by SteemCleaners or Cheetah")
return False
# Checking if the voting power is over 60%:
if (mainaccount['voting_power'] < 60):
print("Not Enough Voting Power")
return False
# Checking if we already voted for this post:
names = account[k]
for avote in upvote_comment['active_votes']:
if (avote['voter'] in names):
print("@%s %s ====> Post Upvoted already by", account[k])
return False
# UPVOTING THE POST
upvote_comment.vote(100, voter=account[k])
# Upvote has now been done and it will now print a message to your screen:
print(upvote_comment, " ====> UPVOTED by", account[k])
print("Voting Power Left:", mainaccount['voting_power'])
upvote_history.append(upvote_comment.identifier)
except:
print("ERROR - Upvoting failed for", account[k])
print("We have probably already upvoted this post before the author edited it.")
print(str(e))
Hi,
I am working on a voting bot
for a Reddit-like use. This bot controls 6 accounts. The problem I'm running into is when I run the section of code that checks if one of my accounts have already voted for the post.
Let's say account 5 has already voted for the post:
The current code stops the enumeration altogether, so account 6 never gets a chance to run through the checks.
If I change the return False
to continue
, account 5 attempts to vote and because it has already voted, the exception also stops the script altogether.
I have tried break
, pass
, etc. I'm thinking now that I may have an indentation problem. Surely it is an easy fix and I'm just missing something.