Steemit Upvote Bot Script


SUBMITTED BY: simplymieke

DATE: Jan. 11, 2018, 11:55 a.m.

FORMAT: Text only

SIZE: 2.8 kB

HITS: 295

  1. 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.
  2. from piston.steem import Steem
  3. from piston.steem import BroadcastingError
  4. import threading
  5. import time
  6. import random
  7. # my favorite blogs on steemit
  8. top_writers = ["ned", "contentjunkie", "dantheman", "furion"]
  9. # add my favorites
  10. # shoutout to my lil sister @mwpower, she loves to write but gets discouraged fast
  11. my_favorites = ["contentjunkie"]
  12. my_subscriptions = top_writers + my_favorites
  13. #put your details here only put the active key if you want to tip people in your favorites list
  14. account = ""
  15. posting_key = ""
  16. active_key = ""
  17. #the number of seconds to wait after a post is published before you vote 1800 seconds = 30 minutes
  18. vote_delay = 1800
  19. upvote_history = []
  20. def feed():
  21. print("Waiting for new posts by %s\n" % my_subscriptions)
  22. steem = Steem(wif=posting_key, node="wss://node.steem.ws")
  23. for comment in steem.stream_comments():
  24. if comment.author in my_subscriptions:
  25. # Comments don't have titles. This is how we can know if we have a post or a comment.
  26. if len(comment.title) > 0:
  27. # check if we already upvoted this. Sometimes the feed will give duplicates.
  28. if comment.identifier in upvote_history:
  29. continue
  30. print("New post by @%s %s" % (comment.author, url_builder(comment)))
  31. workerThread = threading.Thread(name=comment.identifier, target=worker, args=(comment,))
  32. workerThread.start()
  33. # send $2 in SBD
  34. def send_a_tip(author):
  35. steem = Steem(wif=active_key)
  36. steem.transfer(author, 2.0, "SBD", memo="I love your blog. Here is a small gift for you.", account=account)
  37. def url_builder(comment):
  38. return "https://steemit.com/%s/%s" % (comment.category, comment.identifier)
  39. def worker(worker_comment):
  40. time.sleep(vote_delay)
  41. try:
  42. worker_comment.vote(100, account)
  43. print("====> Upvoted")
  44. upvote_history.append(worker_comment.identifier)
  45. except BroadcastingError as e:
  46. print("Upvoting failed...")
  47. print("We have probably reached the upvote rate limit.")
  48. print(str(e))
  49. if comment.author in my_favorites:
  50. send_a_tip(comment.author)
  51. print("====> Sent $2 SBD to @%s" % comment.author)
  52. if __name__ == "__main__":
  53. while True:
  54. try:
  55. feed()
  56. except (KeyboardInterrupt, SystemExit):
  57. print("Quitting...")
  58. break
  59. except Exception as e:
  60. traceback.print_exc()
  61. print("### Exception Occurred: Restarting...")
  62. You will need Python 3 and Piston to run.
  63. python3 upvote_bot.py

comments powered by Disqus