steemit/steem-js

Help with adding a 3 min vote delay to this script

Closed this issue · 2 comments

Expected behavior

It should upvote posts from created according to the limit set

Actual behavior

I got error that

RPCError: 10 assert_exception: Assert Exception elapsed_seconds >= STEEM_MIN_VOTE_INTERVAL_SEC: Can only vote once every 3 seconds. {} th_a vote_evaluator.cpp:85 do_apply {} th_a vote_evaluator.cpp:232 do_apply {"op":["vote",

How to reproduce

steem.api.getDiscussionsByCreated(limit: 20}, function(err, result){

result.forEach(function(row){
const wif = "XXX",
voter = "zoneboy",
author = row.author,
permlink = row.permlink,
weight = 1000;
steem.broadcast.vote(wif, voter, author, permlink, weight, function(err, result) {
console.log(err, result);
if(err)
alert('Fail ' + err);
else
alert('Success');
});
});
});

Environment information

I am using windows 10


I just need someone to help me include voting delay in the script. I heard it's setInterval but I don't know how to.


Thanks

Hi - setInterval() is not part of steem-js, but is a very common way to delay things in javascript.

Here’s a generic tutorial that should help you: https://javascript.info/settimeout-setinterval

Thanks.