Post Promoter JavaScript Voting Bot - Blacklist Tags, Witness Vote Messages & More!

in #utopian-io7 years ago (edited)

loudspeaker-1459128_640.png

More bots are running the Post Promoter software now than I can even keep track of and I'm getting requests for new features on daily basis! So here's the latest round of new goodies for all you bot owners (and users) out there...

Blacklist Tags

One nice feature that was requested was the ability to blacklist posts with certain tags. If a bot owner does not want to support posts with certain tags they can now add those tags in the new "blacklisted_tags" array in the config.json file like so:

"blacklisted_tags": ["nsfw", "other_undesired_tag"],

Any bids that are submitted for posts with one or more blacklisted tags will be automatically refunded to the user (if refunds are enabled) with a message indicating which tag(s) are not allowed by the bot. The code for that feature is relatively simple and added to the checkPost() function:

// Check if any tags on this post are blacklisted in the settings
if (config.blacklisted_tags && config.blacklisted_tags.length > 0 && result.json_metadata && result.json_metadata != '') {
  var tags = JSON.parse(result.json_metadata).tags;

  if (tags && tags.length > 0) {
    var tag = tags.find(t => config.blacklisted_tags.indexOf(t) >= 0);

    if(tag) {
      refund(sender, amount, currency, 'blacklist_tag', 0, tag);
      return;
    }
  }
}

Minimum Refund Amount

Funny story here...I registered the @postpromoter account with GINAbot a little while back to receive notifications when certain events happened. This involves sending a 0.001 STEEM transaction with a particular memo to the @ginabot account and then @ginabot sends a 0.001 STEEM transaction back with a success message.

Since @postpromoter automatically refunds any invalid bids it sent the 0.001 STEEM right back to @ginabot and thus the great bot refund war began. The quick fix at the time was to add "ginabot" to the no_refunds list in the config settings, however as a better solution to prevent refunds of transfer messages in general a new "min_refund_amount" setting was added.

"min_refund_amount": 0.002

With this the bot will no longer refund transactions less than 0.002 STEEM or SBD and thus prevent future refund wars and promote peace on the blockchain.

Max Bids Per Author Per Round

There are always those few users who feel the need to make a ridiculous number of posts every day and buy small upvotes for all of them using the voting bots. While many bots blacklist these users I thought I would also add another option to limit the number of upvotes a single author can receive in each bidding round. You can now set this using the following new setting:

"max_per_author_per_round": 1

With the above configuration, an author may only receive an upvote on one of their posts each round, regardless of who sends the bid. At some point I would also like to add a similar setting to limit upvotes by author by day, however that's a much more involved change since the bot software doesn't currently save bid data prior to the previous round.

The code for that is also in the checkPost() method and is as follows:

// Check if this author has gone over the max bids per author per round
    if(config.max_per_author_per_round && config.max_per_author_per_round > 0) {
      if(outstanding_bids.filter(b => b.author == author).length >= config.max_per_author_per_round)
      {
        refund(sender, amount, currency, 'bids_per_round');
        return;
      }
    }

Witness Vote Request Transfer Memo

This feature was requested by some bot owners who are also Steem witnesses, like myself. If enabled, each time a user submits a bid to the bot it will check if that user votes for the bot owner for witness (either directly or via proxy). If not it will send them a 0.001 STEEM or SBD transfer with a message asking for their vote to help support the bot. To enable this you must set the following two settings in config.json:

"owner_account": "bot_owner_account",
"transfer_memos": {
...
"witness_vote": "Thank you for promoting your post with [bot name]! Please consider voting for [bot owner] for witness at https://steemit.com/~witnesses to support the service!"
}

The code for this feature is a bit more interesting. It's a new recursive method called checkWitnessVote(). It's recursive in the case of voting by proxy. It has to continue to follow the trail of proxies until it arrives at the final voter account:

function checkWitnessVote(sender, voter, currency) {
  if(!config.owner_account || config.owner_account == '')
    return;

  steem.api.getAccounts([voter], function (err, result) {
    if (result && !err) {
      if (result[0].proxy && result[0].proxy != '') {
        checkWitnessVote(sender, result[0].proxy, currency);
        return;
      }

      if(result[0].witness_votes.indexOf(config.owner_account) < 0)
        refund(sender, 0.001, currency, 'witness_vote', 0);
    } else
      logError('Error loading sender account to check witness vote: ' + err);
  });
}

Thanks for your support!

I feel like these posts are getting longer and longer! Does anyone actually read all of this stuff? If you read this, let me know in the comments! As always I want to thank everyone who has helped and supported me in creating this software. Please stay tuned for more updates in the coming weeks!

Links to relevant commits:



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Thank you for the contribution. It has been approved.

Great job, I like the witness idea. Not too strange since I'm witness as well. ;-)

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

Hey @helo, I just gave you a tip for your hard work on moderation. Upvote this comment to support the utopian moderators and increase your future rewards!

Great work @yabapmatt, as a newbie, u are the 1st witness that i have voted for on steemit; and thats because i am motivated by your selfless work for the community...i sincerely appreciate your efforts....Keep up the good work...cheers

Thank you @fqtee, it's always great to see new users on the platform! Please feel free to reach out to me any time if you have questions or need help with anything!

In my culture,(Yoruba land) we refer to persons like u as "Eshin-waju" meaning the pace-setting horse-a leader! Thanks a lot for your kind words; i will surely reach out to you on some areas of concerns; and i will like ur inputs on how i can bring a re-known international NGO to this platform...Cheers

Can I have this advantage too @yabapmatt?

I will like to reach out too@yabapmatt

i do not appreciate someone advertising for free on my post, since you released your new software i don't think anybody has a chance to make a buck anymore. thanks but no thanks

Who is advertising for free on your posts? and what does my voting bot software have anything to do with that? Also it seems like content publishers are making more money on Steem now than they ever have before so I really have no idea what you're talking about.

If you can provide some specific examples of things you don't like I would be happy to respond to them.

I am still waiting on my upvote for this post: https://steemit.com/poetry/@nicholas83/a-psalm-of-home. I sent 3 SBD.

Hi @nicholas83 - the bot upvotes about once every 2.4 hours so you need to be a little patient. It looks like you have already gotten your vote at this point. Please check the Steem Bot Tracker website to see when the bot's next round of voting will begin.

Hi @yabamatt I am still a minnow, actually a plankton according to busy.org and I just got sent an upvote from @postpromoter for @jerrybanfield's Supernatural Writing Contest. I was supposed to receive around $50 for entering. The bid was 20 Steem from @gmichelbkk which should equate to roughly $80 with a current value of a little over $4 for 1 Steem dollar. (I guess it isn't a 100% return upvote?)

Here is what the transaction looked like in your wallet...

3 hours ago Receive 20.000 STEEM from gmichelbkk https://steemit.com/jerrybanfield/@janellelanae/healing-my-dna-and-soul-trauma-swc-jerrybanfield-repost-with-proper-1st-tag

My question and concern is why was my vote from @postpromoter only $34 for 20 Steem. :-( I'm not trying to be greedy but I guess I am a little disappointed and I don't understand why I got such a small upvote in comparison to the pretty good sized bid.

Hi @janellelanae - due to the fact that Steem Dollars (SBD) are now worth about $5 rather than $1 like they are intended, the value of votes shown on steemit.com and other sites is not really correct.

Assuming your post is set to pay out 50/50 SBD and SP then your payout from the $34 vote will be as follows:

After 25% curation the $34 vote will be worth $25.50. You will receive half of that in SBD, which is 12.75 SBD. At the current price of about $5.30 / SBD that is worth about $67.57. Additionally you will receive the other half of the payout in SP, so you will receive $12.75 of SP at the current price of STEEM.

If you add those you will see that the total value of the $34 vote is actually about $80 that you will receive.

Wow. Thank you. I had no idea it was so off. Thank you for getting back to me about this and explaining it. I feel kind of embarrased now but thank you for kindly explaining it to me. I will vote for you as a witness. Thanks again.

Definitely no need to feel embarrassed, it's overly complicated and confusing right now and many, if not most, of the people here don't really understand it! The good news is that for those of us posting on the platform the high price of SBDs lets us earn a lot more money from our posts!

Yes they seem to get longer but I am still reading them. Thanks again for your information it helps. 👍👍👍👏👏👏😃🎉🎉

Thanks for the work you're doing @yabamatt! I really like the feature you've added for the witness vote request. I wish more Steemit users would take advantage of their opportunity to shape the platform by supporting witnesses like yourself that are consistently contributing to the community. --dt

the bot refund war LOL

I'm glad someone appreciates my little bits of humor :-)

Thats wonderful thought of you

:/ paid 3 Steem worth (12$) to get an 8$ steem payout...

Since @postpromoter automatically refunds any invalid bids it sent the 0.001 STEEM right back to @ginabot and thus the great bot refund war began. The quick fix at the time was to add "ginabot" to the no_refunds list in the config settings, however as a better solution to prevent refunds of transfer messages in general a new "min_refund_amount" setting was added.

No need to squabble over this issue. You guys can send me the 0.001 STEEM since it's causing issues 😁😁😁.

Thank you for the update tho :)

읽어도 무슨 말 인지 모르겠네요.