New Features: Upvote Queue Steem Bot Updates 0.1.1

in #utopian-io6 years ago (edited)

Upvote Queue Bot Features

Auto Reward Claiming

I thought this bot could do so much more for me than just queue up my upvotes. I thought one thing it could do is claim my rewards when I'm not around since it is running and periodically checking the blockchain already.

I added a feature that allows it to periodically check accounts of the user running it and claim SBD, STEEM, or SP that are ready to be claimed every 20 minutes.

New Marking with Tags

I've gotten a lot of negative feedback about my approach. A lot of people did not approve of the content I was using in my comments even though they were getting a free vote from it. Then there was also the question, "Is this or is it not spam".

I added a change that is only the first of many changes to this bot to convert it into an alternative voting system that allows me to vote from the command line or chrome extension through a comment. I could go an leave an actual comment, but in the json_metadata_ for the comment it will indicate whether to vote the post and how much of a vote (can be negative).

Changes

diff --git a/upvote-queue-steem-bot/app/helpers/bot/claim.js b/upvote-queue-steem-bot/app/helpers/bot/claim.js
new file mode 100644
index 0000000..1e6c3db
--- /dev/null
+++ b/upvote-queue-steem-bot/app/helpers/bot/claim.js
@@ -0,0 +1,45 @@
+'use strict'
+
+const steem = require('steem')
+const {user, wif } = require('../../config')
+
+module.exports = {
+    execute
+}
+
+/** 
+ * Claims reward balance
+ * Invokes the following API
+ * {
+ *    "roles": ["posting", "active", "owner"],
+ *    "operation": "claim_reward_balance",
+ *    "params": [
+ *      "account",
+ *      "reward_steem",
+ *      "reward_sbd",
+ *      "reward_vests"
+ *    ]
+ * }
+ */
+function execute() {
+    return steem.api.getAccountsAsync([ user ])
+        .map((account) => {
+            return {
+                name: account.name,
+                sbd: parseFloat(account.reward_sbd_balance),
+                steem: parseFloat(account.reward_steem_balance),
+                sp: parseFloat(account.reward_vesting_balance)
+            }
+        })
+        .filter((account) => account.sbd > 0 || account.sp > 0)
+        .each((account) => {
+            console.log("Account %s", JSON.stringify(account));
+            return steem.broadcast.claimRewardBalanceAsync(wif, user, account.steem, account.sbd, account.sp)
+                .then((results) => {
+                    console.log("Claim balance %s", JSON.stringify(results));
+                })
+                .catch((err) => {
+                    console.log("Unable to claim reward balance %s", JSON.stringify(err));
+                }) 
+        });
+}

The above is a new scheduled process that claims rewards

\ No newline at end of file
diff --git a/upvote-queue-steem-bot/app/helpers/bot/index.js b/upvote-queue-steem-bot/app/helpers/bot/index.js
index b014f55..c967213 100644
--- a/upvote-queue-steem-bot/app/helpers/bot/index.js
+++ b/upvote-queue-steem-bot/app/helpers/bot/index.js
@@ -10,5 +10,6 @@ module.exports = {
 
 function run() {
     scheduler.scheduleJob(EVERY_20_MINUTES, require('./upvote'))
+    scheduler.scheduleJob(EVERY_20_MINUTES, require('./claim'))
     // require('./upvote.js').execute()
 }

The above adds the new process and schedules it every 20 minutes.

\ No newline at end of file
diff --git a/upvote-queue-steem-bot/app/helpers/bot/upvote.js b/upvote-queue-steem-bot/app/helpers/bot/upvote.js
index 21f61ac..9cbd09c 100644
--- a/upvote-queue-steem-bot/app/helpers/bot/upvote.js
+++ b/upvote-queue-steem-bot/app/helpers/bot/upvote.js
@@ -11,7 +11,7 @@ module.exports = {
     execute
 }
 
-const FLAG = 'https://steemitimages.com/0x0/https://memegenerator.net/img/instances/500x/71701676/my-ultimate-is-still-charging.jpg'
+const FLAG = '#upvotethispost'
 
 const SECONDS_PER_HOUR = 3600
 const PERCENT_PER_DAY = 20

Uses tagging instead of an image

Roadmap

  • New chrome extension that adds button "Defer Upvote".
  • Changes to bot that check for json_metadata to indicate an upvote
  • CLI for voting with comments.



Posted on Utopian.io - Rewarding Open Source Contributors

Sort:  

Oh wow! Auto award claiming!? Epic!

Thanks for sharing. There is a lot I can learn from your code. Cheers.

Thank you for the contribution. It has been approved.

Please put in more work into one contribution.

You can contact us on Discord.

[utopian-moderator]

Yeah. Looking back, not proud of this one. Thanks.

Hey @r351574nc3 I am @utopian-io. I have just upvoted you!

Achievements

  • You have less than 500 followers. Just gave you a gift to help you succeed!
  • Seems like you contribute quite often. AMAZING!

Community-Driven Witness!

I am the first and only Steem Community-Driven Witness. Participate on Discord. Lets GROW TOGETHER!

mooncryption-utopian-witness-gif

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

Nice added feature.

Coin Marketplace

STEEM 0.28
TRX 0.11
JST 0.031
BTC 69122.82
ETH 3737.08
USDT 1.00
SBD 3.68