Update for Steem Basic Income Automation - Blacklist database, automatic enrollment transfers and improve status reply

in #utopian-io6 years ago (edited)

Repository

https://github.com/holgern/steembasicincome

Blacklist database added

A new blacklist database with a tags, apps and body field was added.
image.png
The blacklisted tags,apps and keywords can be changed anytime directly in the database.

The fields are read out in sbi_stream_post_comment.py and three lists were build:

    blacklist = blacklistStorage.get()
    
    blacklist_tags = []
    for t in blacklist["tags"].split(","):
        blacklist_tags.append(t.strip())
    
    blacklist_apps = []
    for t in blacklist["apps"].split(","):
        blacklist_apps.append(t.strip())

    blacklist_body = []
    for t in blacklist["body"].split(","):
        blacklist_body.append(t.strip())

The tags from the posts are then checked of one is stored in blacklist_tags.
If a blacklisted tag was found, the post will be skipped.

for tag in c["tags"]:
    if tag is not None and tag.lower() in blacklist_tags:
        skip = True

In the next step the app, which was used to create the post, is extracted. As there are some different ways to store the app, the script is doing some checks first:

json_metadata = c.json_metadata
if isinstance(json_metadata, str):
    try:
        json_metadata = json.loads(json_metadata)
    except:
        json_metadata = {}
if "app" in json_metadata:
    app = json_metadata["app"]
    if isinstance(app, dict) and "name" in app:
        app = app["name"]
    if app is not None and isinstance(app, str) and app.find("/") > -1:
        app = app.split("/")[0]
    if app is not None and isinstance(app, str) and app.lower() in blacklist_apps:
        skip = True

Finally, the body is scanned for blacklisted words. This is useful for letting a member disabling upvotes for a specific comment, as it is not easily possible to attach tags to a comment (which could be used for disabling upvotes on the comment instead).

for s in blacklist_body:
    if c.body.find(s) > -1:
        skip = True

Sending automatic enrollment transfer memos to new members

Enrollment to new member is now done automatically. A new database transfer_memos has been added, in which the memo text for the diffect memo transfer types welcome (is sent to new members), sponsoring (is sent to new sponsored members), sp_delegation (can be sent when a member is delegating SP), update_rshares (can be sent when a member increases their shares), sponsoring_update_rshares (can be sent when a member is sponsored and receive more shares).

image.png

For each type a new function was created:

def memo_sponsoring(transferMemos, memo_transfer_acc, s, sponsor):
    if "sponsoring" not in transferMemos:
        return
    if transferMemos["sponsoring"]["enabled"] == 0:
        return
    if memo_transfer_acc is None:
        return    
    try:
        if "%s" in transferMemos["sponsoring"]["memo"]:
            memo_text = transferMemos["sponsoring"]["memo"] % sponsor
        else:
            memo_text = transferMemos["sponsoring"]["memo"]
        memo_transfer_acc.transfer(s, 0.001, "STEEM", memo=memo_text)
    except:
        print("Could not sent 0.001 STEEM to %s" % s)

The try/except check prevents the script from crashing when for example the active key is wrong, not sufficient STEEM are left on the account or the RC is to low.

It is checked every 144 minutes in sbi_update_member_db.py if new members should be enrolled or if existing member are increasing their sbi units. It is now possible to send everytime a 0.001 STEEM memo with a configurable memo text (the sponsoring account name and the sbi units are added and a %s / %d placeholder is used. A memo is only sent when it is enabled by setting enabled to 1 in the database.

Improved sbi status replies.

The reply of the !sbi status command has been enhanced.
image.png

The percentage of subscribed_rshares, delegation_rshares, curation_rshares and other_rshares which build the total SBI upvote value is now shown in the reply to a comment containing !sbi status.

Commits

new sql table structure

Improve reply layout

Add transfer memo database and sending transfers to new members

  • commit 2b7bbcb
  • Add flag for transfer memo account
  • Implement transfer memo functions for the different memo types (welcome, sponsoring, update_shares and sponsoring_update_shares)

Add blacklist database

  • commit 2cedbb2
  • votes on posts with a blacklisted content word, a blacklisted tag or app are skipped
  • sbi status reply improved, it is now shown from where the sbi upvote value is build

GitHub Account

https://github.com/holgern

Sort:  

!sbi status

Hi @emrebeyler!

  • you have 37 units and 0 bonus units
  • your rshares balance is 292751498756 or 0.209 $
  • your next SBI upvote is predicted to be 0.042 $

Structure of your total SBI vote value:

  • 48.62 % has come from your subscription level
  • 34.31 % has come from your bonus units
  • 17.08 % has come from upvoting rewards
  • 0.00 % has come from new account bonus or extra value from pre-automation rewards


    Did you know Steem Basic Income has a Quality Policy?

Thank you for your review, @emrebeyler! Keep up the good work!

!sbi status

Hi @bleujay!

  • you have 2 units and 0 bonus units
  • your rshares balance is 85781171578 or 0.059 $
  • your next SBI upvote is predicted to be 0.012 $

Structure of your total SBI vote value:

  • 43.13 % has come from your subscription level
  • 0.00 % has come from your bonus units
  • 0.00 % has come from upvoting rewards
  • 56.87 % has come from new account bonus or extra value from pre-automation rewards


    Value % breakdowns are in beta and some oddities may appear. These % are historical and represent source of vote value pending and already delivered. Recent changes (increase in delegated SP, for example) may take time to noticeably change the % breakdown.

Great work, as always! I'll tack some info into the memo footer that will add clarity until people get used to seeing this much information.

Loading...

Thanks for your efforts, @holger80!

!sbi-a status
!sbi status

Posted using Partiko Android

Hi @amico!

  • you have 156 units and 685 bonus units
  • your rshares balance is 1458346260582 or 1.039 $
  • as you did not write a post within the last 7 days, your comments will be upvoted.
  • your next SBI upvote is predicted to be 0.042 $

Structure of your total SBI vote value:

  • 8.63 % has come from your subscription level
  • 83.76 % has come from your bonus units
  • 7.05 % has come from upvoting rewards
  • 0.56 % has come from new account bonus or extra value from pre-automation rewards


    Did you know Steem Basic Income has a Quality Policy?
  • as you did not write a post within the last 7 days, your comments will be upvoted.

Is it a bug, @holger80?

Posted using Partiko Android

The comment toggle has never quite worked correctly, but because it minimally impacts a very small number of people, we haven't prioritized finding the root cause and fixing it.

#sbi-skip

To me, it's not a problem: I love receiving upvotes on comments, LOL! 😜

Posted using Partiko Android

Yes, this is a bug.
It should be fixed by now.

It would be great to have the possibility of choice between upvotes on posts / comments / both from @steembasicincome.

What do you think, @josephsavage? 🤔

Generally speaking we prefer to deliver the upvotes via post, but comment upvoting is a backup alternative for users that do not post actively but are still engaged in Steem communities.

We will eventually make a change so that users receiving full upvotes and still coming up short of their target upvote size would have comment voting turned on to receive support on comments and posts, but we need to bring the VP up again before that can be deployed.

That would be cool 😎

Posted using Partiko Android

!sbi status

Hi @barton26!

  • you have 9 units and 0 bonus units
  • your rshares balance is 1465003867019 or 1.027 $
  • as you did not wrote a post within the last 7 days, your comments will be upvoted.
  • your next SBI upvote is predicted to be 0.041 $

Structure of your total SBI vote value:

  • 24.94 % has come from your subscription level
  • 0.00 % has come from your bonus units
  • 75.06 % has come from upvoting rewards
  • 0.00 % has come from new account bonus or extra value from pre-automation rewards


    Value % breakdowns are in beta and some oddities may appear. These % are historical and represent source of vote value pending and already delivered. Recent changes (increase in delegated SP, for example) may take time to noticeably change the % breakdown.

!sbi status

Hi @reggaemuffin!

  • you have 201 units and 0 bonus units
  • your rshares balance is 943162234318 or 0.672 $
  • as you did not write a post within the last 7 days, your comments will be upvoted.
  • your next SBI upvote is predicted to be 0.027 $

Structure of your total SBI vote value:

  • 19.63 % has come from your subscription level
  • 0.00 % has come from your bonus units
  • 80.37 % has come from upvoting rewards
  • 0.00 % has come from new account bonus or extra value from pre-automation rewards


    Value % breakdowns are in beta and some oddities may appear. These % are historical and represent source of vote value pending and already delivered. Recent changes (increase in delegated SP, for example) may take time to noticeably change the % breakdown.

Hi @holger80!

Your post was upvoted by @steem-ua, new Steem dApp, using UserAuthority for algorithmic post curation!
Your post is eligible for our upvote, thanks to our collaboration with @utopian-io!
Feel free to join our @steem-ua Discord server

Can you explain where the upvoting rewards come from please @holger80?

Thanks!

Upvoting rewards come from upvoting the SBI updates. This is explained in detail in the new FAQ:
https://steemit.com/steembasicincome/@steembasicincome/frequently-asked-questions

Thanks very much @josephsavage. I'll take a look. 😊

Always a pleasure having you around here.
!sbi status

Posted using Partiko Android

Hi @abitcoinskeptic!

  • you have 60 units and 50 bonus units
  • your rshares balance is 1394813989624 or 0.993 $
  • your next SBI upvote is predicted to be 0.199 $

Structure of your total SBI vote value:

  • 23.86 % has come from your subscription level
  • 18.67 % has come from your bonus units
  • 54.32 % has come from upvoting rewards
  • 3.15 % has come from new account bonus or extra value from pre-automation rewards


    Did you know Steem Basic Income has a Quality Policy?

!sbi status

Hi @gillianpearce!

  • you have 44 units and 0 bonus units
  • your rshares balance is 103358665732 or 0.074 $
  • your next SBI upvote is predicted to be 0.015 $

Structure of your total SBI vote value:

  • 88.03 % has come from your subscription level
  • 0.00 % has come from your bonus units
  • 1.58 % has come from upvoting rewards
  • 10.39 % has come from new account bonus or extra value from pre-automation rewards


    Did you know Steem Basic Income has a Quality Policy?

Bitcoin is the biggest currency in cyberspace

Posted using Partiko Android

Thank you so much for participating in the Partiko Delegation Plan Round 1! We really appreciate your support! As part of the delegation benefits, we just gave you a 3.00% upvote! Together, let’s change the world!

!sbi status

Posted using Partiko iOS

Hi @theb0red1!

  • you have 118 units and 501 bonus units
  • your rshares balance is 1983085025077 or 1.412 $
  • your next SBI upvote is predicted to be 0.282 $

Structure of your total SBI vote value:

  • 47.79 % has come from your subscription level
  • 50.99 % has come from your bonus units
  • 1.21 % has come from upvoting rewards
  • 0.00 % has come from new account bonus or extra value from pre-automation rewards


    Value % breakdowns are in beta and some oddities may appear. These % are historical and represent source of vote value pending and already delivered. Recent changes (increase in delegated SP, for example) may take time to noticeably change the % breakdown.

!sbi status

Hi @darthgexe!

  • you have 64 units and 0 bonus units
  • your rshares balance is 315107759274 or 0.224 $
  • your next SBI upvote is predicted to be 0.045 $

Structure of your total SBI vote value:

  • 99.35 % has come from your subscription level
  • 0.00 % has come from your bonus units
  • 0.65 % has come from upvoting rewards
  • 0.00 % has come from new account bonus or extra value from pre-automation rewards


    Value % breakdowns are in beta and some oddities may appear. These % are historical and represent source of vote value pending and already delivered. Recent changes (increase in delegated SP, for example) may take time to noticeably change the % breakdown.

Congratulations @holger80! You have completed the following achievement on the Steem blockchain and have been rewarded with new badge(s) :

You got more than 700 replies. Your next target is to reach 800 replies.
You received more than 9000 as payout for your posts. Your next target is to reach a total payout of 10000

You can view your badges on your Steem Board and compare to others on the Steem Ranking
If you no longer want to receive notifications, reply to this comment with the word STOP

To support your work, I also upvoted your post!

Do not miss the last post from @steemitboard:

Are you a DrugWars early adopter? Benvenuto in famiglia!
Vote for @Steemitboard as a witness to get one more award and increased upvotes!

!sbi status

Posted using Partiko Android

Hi @mattuk!

  • you have 8 units and 0 bonus units
  • your rshares balance is 121270778692 or 0.086 $
  • your next SBI upvote is predicted to be 0.017 $

Structure of your total SBI vote value:

  • 51.77 % has come from your subscription level
  • 0.00 % has come from your bonus units
  • 47.35 % has come from upvoting rewards
  • 0.88 % has come from new account bonus or extra value from pre-automation rewards


    Value % breakdowns are in beta and some oddities may appear. These % are historical and represent source of vote value pending and already delivered. Recent changes (increase in delegated SP, for example) may take time to noticeably change the % breakdown.

Hi, @holger80!

You just got a 2.94% upvote from SteemPlus!
To get higher upvotes, earn more SteemPlus Points (SPP). On your Steemit wallet, check your SPP balance and click on "How to earn SPP?" to find out all the ways to earn.
If you're not using SteemPlus yet, please check our last posts in here to see the many ways in which SteemPlus can improve your Steem experience on Steemit and Busy.

Ich versteh einfach immer nur Bahnhof wenn ich da reinlese... Mir ist zwar klar, dass es hauptsächlich WENN...DANN Funktionen sind, Ausnahmen gebildet werden, die Stränge in bestimmte Richtungen gelenkt werden und Logik die Basis, aber es ist halt doch eine Fremdsprache für mich :-D

Wie lange machst du denn schon JS? Was schätzt du wie lange ein Neuling lernen muss, um solide was programmieren zu können? Welche Umwege würdest rückblickend vermeiden und welche Fragen sollte sich ein Neuling gleich zu Beginn stellen?

LG Martin

Ach so, wichtig ist es ein konkretes Projekt zu haben, welches man unbedingt umsetzen will. Ansonsten verliert man schnell wieder die Lust... Ich denke, dass man mindestens ein halbes Jahr braucht um solide Programmieren zu lernen, wenn man tätlich sich damit beschäftigt.

Ich programmiere in Python seit 2015, habe aber vorher schon C/C++ programmiert.
Die erste Frage, die man sich stellen sollte, ist in welcher Programmiersprache man loslegen will. Python oder JS. Ich würde den Ansatz learning by doing befolgen, dicke Programmierbücher zu lesen ist nur von beschränken nutzen (und macht keinen Spaß). Am besten online tutorials:
https://www.learnpython.org/ oder https://www.learn-js.org/

Ok wow, dann bist du ja wirklich gut aufgestellt mit C, Python und JS.

Witzig dass du es ansprichst, hab mit 16 Visual Basic angefangen und wollte auch C anfangen, aber genau die fetten Bücher waren mir eben zu trocken, was mich abgeschreckt hat. Damals gabs ja nicht wirklich Seiten wie learnpython, was mir übrigens kein Begriff war bis jetzt.

Naja damals gabs ja auch noch das gute alte technisch-singende Einwahlmodem :-D Hat sich schon viel verändert. Was die nächsten 20 Jahre wohl so bringen unter der exponentiellen Entwicklung?

Manchmal reizt es mich schon noch sehr, was zu lernen in dem Bereich. Werd mir mal die empfohlenen Seiten anschauen. Danke dir für die Antwort!

This post has been included in the latest edition of SoS Daily News - a digest of all the latest news on the Steem blockchain.

!sbi status

Hi @cryptocopy!

  • you have 59 units and 75 bonus units
  • your rshares balance is 831495253990 or 0.573 $
  • your next SBI upvote is predicted to be 0.115 $

Structure of your total SBI vote value:

  • 59.64 % has come from your subscription level
  • 25.42 % has come from your bonus units
  • 14.94 % has come from upvoting rewards
  • 0.00 % has come from new account bonus or extra value from pre-automation rewards


    Value % breakdowns are in beta and some oddities may appear. These % are historical and represent source of vote value pending and already delivered. Recent changes (increase in delegated SP, for example) may take time to noticeably change the % breakdown.

Hey, @holger80!

Thanks for contributing on Utopian.
We’re already looking forward to your next contribution!

Get higher incentives and support Utopian.io!
Simply set @utopian.pay as a 5% (or higher) payout beneficiary on your contribution post (via SteemPlus or Steeditor).

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

Vote for Utopian Witness!

!sbi status