Hello Steemit,
this is the second part of the series "how 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.
was a little bit more creative and has done a [multiline string] message. Example: http://stackoverflow.com/a/10660443