Steemit post Bot like @wang for introduceyourself

in #hacking8 years ago (edited)

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

Sort:  

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

Nice information! I like the picture too!

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

  1. apt-get install python3-pip
  2. pip3 install --upgrade pip
  3. pip3 install steem

hi, im getting same error, using python3 on ubuntu

Coin Marketplace

STEEM 0.30
TRX 0.12
JST 0.034
BTC 63799.64
ETH 3130.40
USDT 1.00
SBD 3.97