You are viewing a single comment's thread from:

RE: ARCHON project - as it stands

in Archon11 months ago
from beem import Steem
from beem.discussions import Query, Discussions_by_created, Comment_discussions_by_payout, Discussions_by_active, Discussions
from beem.nodelist import NodeList
from beem.account import Account
from hiveengine.tokenobject import Token
import json
import random
from beem.comment import Comment
import pymongo
from pymongo import MongoClient
from hiveengine.wallet import Wallet
import time
round_share = 0.005
payout_account = "ufm.pay"
ignored = ["gangstalking", "tipu", "beerlover", "hivebuzz", "ecency", "investinthefutur", "cheetah", "poshbot"]
beem_unlock_pass = ""
mongo_cluster = ""
community = "hive-179017"

def sh():
    nodelist = NodeList()
    nodelist.update_nodes()
    nodes = nodelist.get_nodes(hive=True)
    hive = Steem(node=nodes)
    q = Query(limit=55, tag=community)
    cluster = MongoClient(mongo_cluster)
    db = cluster["archon"]
    shc = db["shc_comm"]
    for h in Discussions_by_created(q):
        c = Comment(h, steem_instance=hive)
        comments = c.get_replies(raw_data=False)
        for comm in comments:
            comm_string = str(comm)
            comm_string = comm_string[9:-1]
            print(comm_string)
            peak_link = str("https://www.peakd.com/" + comm_string)
            c = Comment(comm, steem_instance=hive)
            if c.author in ignored:
                continue
            if c.is_pending() is not True:
                continue
            if c.is_comment() is False:
                continue
            check = shc.find_one({"_id": comm_string})
            if check is not None:
                continue
            print(peak_link)
            shc.insert_one({"_id": comm_string, "account": str(c.author), "paid": False, "payout": 0, "peak_link": peak_link})


def payouts():
    cluster = MongoClient(mongo_cluster)
    db = cluster["archon"]
    shc = db["shc_comm"]
    unpaid = shc.find({"paid": False})
    nodelist = NodeList()
    nodelist.update_nodes()
    nodes = nodelist.get_nodes(hive=True)
    hive = Steem(node=nodes)
    acc_table = {}
    total = 0
    for u in unpaid:
        print(u)
        try:
            acc_table[u["account"]] += 1
        except:
            acc_table[u["account"]] = 1
        total += 1
        shc.update_one({"_id": u["_id"]}, {"$set": {"paid": True}})
    print(acc_table)
    print(total)
    wallet = Wallet(payout_account, steem_instance=hive)
    a_bals = wallet.get_token("ARCHON")
    bal = a_bals["balance"]
    print(bal)
    round_cut = float(bal) * float(round_share)
    print(round_cut)
    for user in acc_table:
        per = float(acc_table[user]) / total
        share = float(per) * float(round_cut)
        hive.wallet.unlock(beem_unlock_pass)
        print(wallet.stake(share, "ARCHON", user))
        time.sleep(3)


sh()
payouts()

Sort:  

Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below

Thank you!

We will look into this! Would you be willing to send the keys from the payout_account = "ufm.pay" account?

@taskmanager this is awesome! I am so excited by the possibility of having comment rewards working again! ♥️ If you could make Eco or I a Discord Admin maybe we can figure out how to get that back too? Do you have any suggestions on what we might do to make Discord reporting work again?

Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below

Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below

Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below


Hey @taskmanager, here is a little bit of BEER from @isnochys for you. Enjoy it!

Learn how to earn FREE BEER each day by staking your BEER.

Hello! I see that the @archon-mining account has finished powering down, could I get the keys to that account?

Thank you for your witness vote!
Have a !BEER on me!
To Opt-Out of my witness beer program just comment STOP below