Save the following to a file named upvote_bot.py and update the information section at the top with your information and usernames you want to upvote and tip.
from piston.steem import Steem
from piston.steem import BroadcastingError
import threading
import time
import random
# my favorite blogs on steemit
top_writers = ["ned", "contentjunkie", "dantheman", "furion"]
# add my favorites
# shoutout to my lil sister @mwpower, she loves to write but gets discouraged fast
my_favorites = ["contentjunkie"]
my_subscriptions = top_writers + my_favorites
#put your details here only put the active key if you want to tip people in your favorites list
account = ""
posting_key = ""
active_key = ""
#the number of seconds to wait after a post is published before you vote 1800 seconds = 30 minutes
vote_delay = 1800
upvote_history = []
def feed():
print("Waiting for new posts by %s\n" % my_subscriptions)
steem = Steem(wif=posting_key, node="wss://node.steem.ws")
for comment in steem.stream_comments():
if comment.author in my_subscriptions:
# Comments don't have titles. This is how we can know if we have a post or a comment.
if len(comment.title) > 0:
# check if we already upvoted this. Sometimes the feed will give duplicates.
if comment.identifier in upvote_history:
continue
print("New post by @%s %s" % (comment.author, url_builder(comment)))
workerThread = threading.Thread(name=comment.identifier, target=worker, args=(comment,))
workerThread.start()
# send $2 in SBD
def send_a_tip(author):
steem = Steem(wif=active_key)
steem.transfer(author, 2.0, "SBD", memo="I love your blog. Here is a small gift for you.", account=account)
def url_builder(comment):
return "https://steemit.com/%s/%s" % (comment.category, comment.identifier)
def worker(worker_comment):
time.sleep(vote_delay)
try:
worker_comment.vote(100, account)
print("====> Upvoted")
upvote_history.append(worker_comment.identifier)
except BroadcastingError as e:
print("Upvoting failed...")
print("We have probably reached the upvote rate limit.")
print(str(e))
if comment.author in my_favorites:
send_a_tip(comment.author)
print("====> Sent $2 SBD to @%s" % comment.author)
if __name__ == "__main__":
while True:
try:
feed()
except (KeyboardInterrupt, SystemExit):
print("Quitting...")
break
except Exception as e:
traceback.print_exc()
print("### Exception Occurred: Restarting...")
You will need Python 3 and Piston to run.
python3 upvote_bot.py