Community Helper

in #utopian-io6 years ago (edited)

Community Helper


Link To Github

What is the project about?

You might of seen many communities on steem blockchain. Many of them as big as #untalented and #minnowsupportcommunity but there are also some small ones. After your community starts growing it becomes harder and harder to moderate them and curate good content, that's the reason in many communities there are moderators that exist. Utopian has all system in place but what about other small communities. They can't afford to make a system like this, so they will have these three choices.

  • Delegate some SP to special moderators so that they can curate good posts.
  • Give master key to curators so they can upvote good posts.
  • Have moderators send you all the good posts so you can upvote them.

Problem With Above Approaches

There are problems with each of these approaches and not even one of them is good. If you choose to delegate SP then you will have to divide your SP which will result in lower upvote. If you choose to give master keys then things can turn out to be pretty ugly. If you choose moderators to send you quality posts then this will result in lot of manual work.

Solution

I have made one in all solution to this problem, with my new bot you will not have to worry about dividing your SP neither about giving master key nor about doing so much manual work.

How does it work?

When the bot is up and running, the curators or moderators will be able to upvote the post with the help of "!upvote" command. The bot simultaneously checks each comment and see if it has "!upvote" and first eight characters and if the bot founds and comment then it checks if the author of the comment is in the curators list, if the commentator is in the list of curators then it checks the voting weight. After checking the vote weight bot checks if vote weight is lower than max vote weight and finally if yes then bot upvotes. Bot goes through a lot of steps to ensure security.

As you have read above community manager will be able to set curators or moderators and will also be able to add max vote weight so even by mistake no one will be able to give higher upvote than needed. To upvote a post, curator must follow this syntax !upvote [vote_weight]

Other than upvoting bot also allows resteems and process of resteem is much simpler than process of upvoting. The bot finds a comment "!resteem" then it checks whether the author of the bot is in the list of trusted curators, if yes then bot upvotes the post.

How to setup?

I have tried to make this bot as easy to setup as I can. First you will need to install Python 3.6 and Steempy which you can do by following this awesome tutorial by @amosbastion. After installing those two things, open up the terminal and make sure you are using Linux. In terminal, type "touch community_helper.py" which will create a new python file. Now type "nano community_helper.py", it will open a text file editor in the command. Now copy the code from here and edit it according to your needs. I have added comments to help you edit the code, you mainly have to edit the variable to your needs and add keys.

Technology Stack

To make this project, I have used Python language and also used the help of Steempy to interact with Steem Blockchain.

How to contribute?

Suggestions for this project are most welcome and I will be more than happy to implement them, if they are really good.

Code

# Imports
from steem import Steem
from steem.blockchain import Blockchain
from steem.post import Post

# Variables
s = Steem(nodes=["rpc.steemviz.com"], keys=["Private_Posting_Key",
                                            "Private_Active_Key"])  # Add Keys
blockchain = Blockchain()
stream = map(Post, blockchain.stream(filter_by=["comment"]))

# Adjustable Variables
account = "ACCOUNT"  # Account That Will Be Used For Upvoting
curators = ["CURATOR1", "CURATOR2", "CURATOR3"]  # Add Curators/Moderators (without @)
max_voting_power = 100 # You can obviously change it


# Function
def parent_link() # Function to return parent link of the comment.
    link = "@" + post["parent_author"] + "/" + post["parent_permlink"]
    return link


# Process
while True:
    try:
        for post in stream: # Checks every comment
            comment = (post["body"][:7])
            comment2 = (post["body"][:8])
            if comment == "!Upvote" or comment == "!upvote": # If comment is !upvote or !Upvote
                print("Found A Comment %s" % post["title"])
                voting_weight = float(post["body"][8:])
                if post["author"] in curators and voting_weight <= max_voting_power: # Checks if curator is in list of curators and vote weight is lower than max vote weight.
                    print("Commentator is in curators list")
                    voting_weight = float(post["body"][8:])
                    s.commit.vote(parent_link(), voting_weight, account) # Upvotes the post
                    post.reply("I Just Gave You %s Percent Upvote!" % voting_weight, "Upvote %s Post" % [post["title"]],
                               account)
                    print("Post Upvoted")
                elif post["author"] in curators:
                    print("Commentator is using more than max voting weight allowed")
                    post.reply("%s Give Vote Of Under %s Voting Weight" % (post["author"], max_voting_power)
                               , "Can't Upvote", account)
                elif voting_weight <= max_voting_power:
                    print("Commentator is not in curators list")
                    post.reply("%s Sorry, You Are Not Eligible To Vote" % (post["author"])
                               , "Can't Upvote", account)
            elif comment2 == "!resteem" or comment2 == "!Resteem" and post["author"] in curators: # Checks if comment is !resteem or !Resteem and author is in curators list
                post.resteem(parent_link(), account) # Resteems the post
                post.reply("Post Resteemed!", "Resteemed", account)
    except Exception as error:
        print(repr(error))
continue

Sort:  

@anonfiles, congratulations on making your first post! I gave you a $.05 vote!
Will you give me a follow? I'll follow you back in return!

Thank you for your contribution.


Need help? Write a ticket on https://support.utopian.io.
Chat with us on Discord.

[utopian-moderator]

Thanks for the approval!

Hey @anonfiles

We're already looking forward to your next contribution!

Contributing on Utopian

Learn how to contribute on our website or by watching this tutorial on Youtube.

Utopian Witness!

Vote for Utopian Witness! We are made of developers, system administrators, entrepreneurs, artists, content creators, thinkers. We embrace every nationality, mindset and belief.

Want to chat? Join us on Discord https://discord.gg/h52nFrV