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:
- Updated witness vote message to check voting proxies
- Finished the blacklist tags feature
- Added min refund setting
- Added max bids per author per round setting
Posted on Utopian.io - Rewarding Open Source Contributors