Import basic bot.py file.

in #utopian-io7 years ago (edited)

This is the basic build of the Prosper bot which will work as an upvoter and curator. The goal of this bot is to help selected minnows with good content.

Here is the first code for the beginning of the bot.py file. This currently allows the bot to upvote based on a list in the votelist.txt file. This file will be populated with lesser-known quality content creators.

from steem.steem import Steem
from steem.steem import BroadcastingError
import threading
import time
import random
import csv
 
my_subscriptions = []
 
with open('votelist.txt', mode='r') as infile:
    reader = csv.reader(infile)
    for rows in reader:
        v = rows[0]
        my_subscriptions.append(v)
        
account = ["account_goes_here"]
posting_key = ["password_goes_here"]
vote_delay = random.randrange(1200,1800)

upvote_history = []

def feed():
    print("Waiting for new posts by %s\n\n\nGo Oprah!\nGo Winfrey!" % my_subscriptions)
    steem = Steem(wif=posting_key[0])
    for comment in steem.stream_comments():
 
        if comment.author in my_subscriptions:
            if len(comment.title) > 0:
 
                if comment.identifier in upvote_history:
                    continue
 
                print("New post by @%s %s" % (comment.author, url_builder(comment)))
                workerThread = threading.Thread(name=comment.identifier, target=worker, args=(comment,))
                workerThread.start()

def url_builder(comment):
    return "https://steemit.com/%s/%s" % (comment.category, comment.identifier)
 
def worker(worker_comment):
     time.sleep(vote_delay)
     try:
       for (k,v) in enumerate(account):
         worker_steem = Steem(wif=posting_key[k])
         upvote_comment = worker_steem.get_content(worker_comment.identifier)
         # vote weight 100 full power vote -100 full power flag
         upvote_comment.vote(100, v)
         print("@%s====> ^Upvoted^" % upvote_comment.author)
         upvote_history.append(upvote_comment.identifier)
     except BroadcastingError as e:
       print("@%s<- failed" % upvote_comment.author)
       print(str(e))

 
if __name__ == "__main__":
    while True:
        try:
            feed()
        except (KeyboardInterrupt, SystemExit):
            print("Quitting...")
            break
        except Exception as e:
            traceback.print_exc()
            print("### Exception Occurred: Restarting...")

More features will be added very soon. This is very basic for now.

Commit URL: https://github.com/nolyoly/prosper-ai/commit/f57a735c36717c23bb571899646bc71b6e99029b



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Your contribution can't be approved yet. See the Utopian rules. You need to give the link to the commits or PR or a link to the project in case it is yours. And remove steemit tag.

You can contact us on Discord.
[utopian-moderator]

@ering has voted on behalf of @minnowpond.
If you would like to recieve upvotes from minnowponds team on all your posts, simply FOLLOW @minnowpond.

            To receive an upvote send 0.25 SBD to @minnowpond with your posts url as the memo
            To receive an reSteem send 0.75 SBD to @minnowpond with your posts url as the memo
            To receive an upvote and a reSteem send 1.00SBD to @minnowpond with your posts url as the memo

Hey @noly I am @utopian-io. I have just super-voted you at 12% Power!

Suggestions https://utopian.io/rules

  • Your contribution is less informative than others in this category.
  • Utopian has detected 2 bot votes. I am the only bot you should love!!

Achievements

  • I am a bot...I love developers... <3
  • You have less than 500 followers. Just gave you a gift ;)
    Up-vote this comment to grow my power and help Open Source contributions like this one. Want to chat? Join me on Discord https://discord.gg/Pc8HG9x

Thanks. It's basically just a copy of the Winfrey bot that was shared by someone else awhile ago, but I will be adding more to it very soon.

Coin Marketplace

STEEM 0.18
TRX 0.15
JST 0.028
BTC 63283.09
ETH 2463.49
USDT 1.00
SBD 2.54