2017 Updated Guide on How to Make Your Own Steem Upvoting Bot
I like to share with you today on how to make your own STEEM bot that upvotes the posts of your chosen authors. We will be using @xeroc piston library. This library is coded in python so we will be using python to code the bot. The code below has been tested in Ubuntu 16.0.4 machine.
sudo apt-get install libffi-dev libssl-dev python-dev
$ pip3 install piston-lib piston-cli
If you encounter an issue with pip3, the problem could be it is not installed. To install it:
sudo apt install python3-pip
Now, lets create the file for the bot:
nano vote.py
Paste the code below into the file. Then, save & exit by: ctrl+x
, y
, enter
.
from piston import Steem
import os
import json
steem = Steem(wif="5YOURPRIVATEPOSTINGKEY")
authors = ["gaman","someoneelse"]
for post in steem.stream_comments():
if post["author"] in authors:
post.upvote(voter="youraccount")
To execute it, call:
python3 vote.py
Its easy right? Check out the full documentation: http://lib.piston.rocks/en/develop/
Unless I am mistaken,
stream_comments()
returns instances of classPost
which has the author as a field you can access usingpost["author"]
. That would allow you to remove the additionalget_post()
. Give it a try.hi, i tried using post["author"], but I get an error. I find it strange because in previous guides they use the post["author"]. That is why I use the workaround of get_post.
I tried again and it worked! Thanks.
Hmm .. here it says that
stream_comments
returns instances ofPost()
and here it refreshs the post and stores the content of the post as "dictionary" in thePost()
class.What's the error message?
I tried again and it worked. Thanks.
Would you know which node I can set to for the piston library. I tried several nodes and seemingly I can't do a create_account command. I can only do it in piston.rocks node but it seems the node charges more than the 0.3 steem that other node charge.
Very interesting.
Could you drop one or two lines about the nature of the class
Steem
(do all API's go from there, what can be it's instances), what thewif
argument (a reference to an account?) is, and howvoter
can be something else than "youraccount"?I'll also talk more about Python scripting on Steemit, although I'm more on the algorithmic side of things.
Do you know if there will be TeX style mathtags, eventually?
You put your posting private key on the
wif
argument so that the bot can perform some functions for you like upvoting. The main api class is thesteem
class. As stated in the documentation:About TeX style mathtags, I don't know.
Cool, thanks for your reply, gaman. Do you know good other articles on this library? Or do you have other applications for which it is useful?
Best regards
A fellow scripter
Sadly, on my Mac all installation attemts (pip, pip3, brew, the git package) do fail. Do you know if there is an os or distribution requirement?
Which post it will upvote? The latest one?
only on new posts as it comes in.
Congratulations @gaman! You have completed some achievement on Steemit and have been rewarded with new badge(s) :
Award for the number of comments
Click on any badge to view your own Board of Honor on SteemitBoard.
For more information about SteemitBoard, click here
If you no longer want to receive notifications, reply to this comment with the word
STOP
Great tutorial