Python-Steem Example: Countervote @asshole

View this thread on: d.buzz | hive.blog | peakd.com | ecency.com
·@felixxx·
0.000 HBD
Python-Steem Example: Countervote @asshole
In case you didn't already know, a new user named @asshole downvotes all sorts of comments on steemit.

This morning @englishtchrivy contacted me in Steemit.chat and gave me a nice idea for an example script.
I modified my followvotes - script from here:
https://steemit.com/python/@felixxx/python-steem-example-follow-votes

The new script watches all votes by @asshole, checks the vote's weight and then goes on to negate that vote.

http://i.imgur.com/ExcpMaC.png

# Code

    from steem import Steem
    from steem.blockchain import Blockchain
    chain = Blockchain()

    assholes = ["asshole"]
    pk = ["5HUz4TRlolyouwish778tzU754J94ngb8lme9"]
    account = ["votebot"]

    steem = Steem(keys=pk[0], node="wss://node.steem.ws")

    for operation in chain.ops():
        op = operation["op"]
        if op[0] == "vote":
            #print(op) #uncomment this to see the structure of a vote operation
            comment_voter = op[1]["voter"]
            if comment_voter in assholes:
                comment_link = op[1]["permlink"]
                comment_author = op[1]["author"]
                vote_weight = int(op[1]["weight"]/100)
                comment = steem.get_post("@" + comment_author + "/" + comment_link)
                print("asshole downvoted " + comment_link + " weight:" + str(vote_weight)) 
                for (k,v) in enumerate(account): 
                    try:
                      steem = Steem(keys=pk[k], node="wss://node.steem.ws")
                      vote_weight = (vote_weight * (-1))
                      comment.vote(vote_weight, v) 
                      print("... countered with " + v + " with " + str(vote_weight) + "%")
                    except Exception as e:
                      print("... NOT countered with " + v + " because: ")
                      print(str(e))

# Issues

This script will upvote all comments that @asshole downvotes, with the exact same weight.
So when @asshole downvotes 1%,  the bot will upvote by 1%.
If @asshole started upvoting comments, this script would downvote the comment. 
( that might need a fix )

Ideally, with this bot, it would be easiest to have an account to just counter @asshole with similar SP.

# Conclusion

I will not employ this script, because I don't have a 1K SP account to counter it.
If I countered @asshole with @felixxx in the way above, I would end up upvoting the comment too much, since I have more SP than @asshole.
Also this would drain my voting power.
👍 , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,