Hello Steemit,
this is the second part of the series "how @wang is doing it"
You can read the first post here https://steemit.com/hacking/@seagul/steemit-vote-bot-like-wang-for-introduceyourself
Like i said in my first post, i will publish the post bot for the introduceyourself section
Full python code for post on every new post @introduceyourself
import time
from steemapi.steemnoderpc import SteemNodeRPC
from steembase import transactions
currentTime = int(time.time())
message = "Welcome to Steemit!"
user = "yourUserName"
wif = "yourWifKey"
category = "introduceyourself"
rpc = SteemNodeRPC("wss://steemit.com/wstmp3")
for post in rpc.stream("comment", start=currentTime):
if post["parent_author"] == '' and post["parent_permlink"] == category:
try:
expiration = transactions.formatTimeFromNow(60)
op = transactions.Comment(
**{"parent_author": post["author"],
"parent_permlink": post["permlink"],
"author": user,
"permlink": post["permlink"],
"title": "",
"body": message,
"json_metadata": ""}
)
ops = [transactions.Operation(op)]
ref_block_num, ref_block_prefix = transactions.getBlockParams(rpc)
tx = transactions.Signed_Transaction(
ref_block_num=ref_block_num,
ref_block_prefix=ref_block_prefix,
expiration=expiration,
operations=ops)
tx = tx.sign([wif])
tx = transactions.JsonObj(tx)
rpc.broadcast_transaction(tx, api="network_broadcast")
print("Posted!")
print(post["title"])
except Exception:
print("Oops! Posting")
This script will write "Welcome to Steemit!" under each new post in the introduceyourself section.
@wang was a little bit more creative and has done a [multiline string] message. Example: http://stackoverflow.com/a/10660443
Was watching this account too.
i was sure its a bot.
thanks for sharing this.
It would be quite easy to downvote every post from @wang in @introduceyourself
i am not sure about the actual meaning of it beeing a bot. so i dont want to do this.
but it feels nice to see that somebody like you is into it to let me see clear about my guess if this was a bot. even without investigation.
/the beautiful part is, i can decide to pay you and not@wang because we are steemeans.
we should be nice to @wang as long as it tries to be a nice bot and help beginners :)
It would be nice to know if its a bot
Upvoted. Eventually all of the Bots being created here are going to start some pretty cool projects. People are going to keep building and building. There was another Bot posts the other day, linked below
https://steemit.com/steem/@curator/i-made-a-curation-bot-for-steem
The information is very interesting. As the presenter of this info, I'm curious if you have any words of advice on how to use a bot responsibly
I appreciate good bots if they are used right.
great post, can i change the section by changing the introduceyourself tag?
You can change the section yes
instead of category = "introduceyourself" you can write category = "steemit"
Than you would post on every new post in steemit
It's That was still Bot
It would be so nice to get 50+ times "Welcome to Steemit!" as comments in your introduction post. :D
Indeed ;)
@seagul Is there a way for the script to check if your last vote or comment was made within the last 20 seconds before trying to post anything new?
Hello @soupernerd,
you just need to set a start time and check with a "if", if time elapsed is <20
Example: http://stackoverflow.com/questions/3620943/measuring-elapsed-time-with-the-time-module
start_time = time.time()
elapsed_time = time.time() - start_time
Hi seagul,
What I was actually wondering is this. Steemit seems to throw an error if you try to comment too fast.
Example of the steem error:
"(now - auth.last_post) > STEEMIT_MIN_REPLY_INTERVAL: You may only comment once every 20 seconds"
Is there a way to check against steemit itself, if your last post was within the last 20 seconds? So instead of just checking against elapsed time generally, checking against whatever it is steemit is checking?
I AGREE! Thank you for posting. Hope you get this to snowball to the top!
I up-voted you too... BTW, should steemit let us steemers advertise using steem? Be sure to tell everyone you know to come vote here at: https://steemit.com/steemit/@kingtylervvs/if-steemit-ever-does-decide-to-advertise-there-is-only-1-way-it-could-work-in-my-opinion-debate
This is a democratic community decision.
Hi @seagul! I'm getting this error when trying to run it:
{\rtf1\ansi\ansicpg1252\cocoartf1348\cocoasubrtf170
SyntaxError: unexpected character after line continuation character
Any ideas? Warning, I have no idea what I'm doing!
I'm a noob when it comes to this stuff. Where wouls i put such a code and how would i run it?
You need an python environment and the python-steemlib from @xeroc.
For installation you can read: https://github.com/xeroc/python-steemlib
Than you simply create the file with my code and run it like:
(Ofcause you need to change the "username"and the "wif" key)
python3 fileName.py
Thanks for posting this! I'm replying as a bookmark.
SteemNodeRPC look like not able to be imported ... Traceback (most recent call last):
File "./post_test.py", line 2, in
from steemapi.steemnoderpc import SteemNodeRPC
ImportError: No module named steemapi.steemnoderpc
ubuntu@ubuntu:~/steem/extract$
You need to install the library.
"pip3 install steem"
Installation guide: https://github.com/xeroc/python-steemlib
You need to use python3
Try
hi, im getting same error, using python3 on ubuntu
Nice work!
It's kinda fucked up that we have to write bots because the developers are too lazy (or busy?) to write a much needed FAQ.
Much needed FAQ here:
https://steemit.com/steemit/@intelliguy/steemit-faq-frequently-asked-questions-common-myths-and-misconceptions
Yeah found it yesterday, but thanks :)
not working .. have install xero's steem lib....
Traceback (most recent call last):
File "./post_test.py", line 2, in
from steemapi.steemnoderpc import SteemNodeRPC
ImportError: No module named steemapi.steemnoderpc
ubuntu@ubuntu:~/steem/extract$
You need to use "python3".
Have you installed the library for pip3?
Try
I'm using Windows and had the same problem. For some reason PYTHONPATH didn't have the default directory for all my python packages listed.
At the top of your "post_test.py" file put:
import sys
print(sys.path)
That will tell you what PYTHONPATH is searching through for imports. Use ."append" to add the location of your steemapi folder. For me that was:
import sys
sys.path.append("C:\Python34\Lib\site-packages")
print(sys.path)
whoa, you are allowed to do bots here?
thanks.
if i am running a local node . Can i switch following line to local node and what the syntax could be
rpc = SteemNodeRPC("wss://steemit.com/wstmp3")
Something like rpc = SteemNodeRPC("ws://localhost:8090") maybe
thanks
great work
thanks for sharing this tho