SweeVer avatar

Development of Resteemit

sweever

Published: 04 Dec 2017 › Updated: 04 Dec 2017Development of Resteemit

Development of Resteemit

resteemit contribution.png


This is my first mirged contribution to the development of resteemit by adding some new advanced changement in the Script.


Resteemit.com is a Public Curation Project
Resteemit take any steemit article and resteem it on resteemableHive account@resteemable, from where the post is upvoted by the resteemable trail.


Project by gktownHive account@gktown he was giving 10% upvote for every resteemed postes ,
He asked to create a system that either monitors current vote power or counts the number of votes given in a 24 hour period. we need to vote all resteemed posts in 24h with using 20% of power .

After alot of discussions we decided to give a 100% vote every 2H20MIN to satisfy resteemit.com users.

Changement summary :

  • Add configured variables in top of file .
  • Add new module
  • Add new function that allow Resteemit to sleep in a specified time
  • Add time Calculator to log time left for next vote
  • Add Function that Push reblogged postes in a list(Array) when Bot is sleeping
    and after is awake -it will share a specified vote with the total of posts resteemed.


    First steep i added botSleep function that make bot sleep in a specified time , it can be configured from the variable Bconfig .


    Next step is the fuction resteemable it containe a lot og things , at every request to resteemit.com this function is called .

    Whith this condition if(SleepAt > CurrentDate)we check if the bot still sleeping or not , if is sleeping we push poste info with
    awaitingPosts.push(Suser+"//"+Stitle); into array awaitingPosts also we log time left for bot to wake up .

var s = ((SleepAt - CurrentDate) / 60000)*60 ;
var h = s / 60 / 60 ;
var m = s / 60 ;
if(h > 4){m = m -240;h = 4}
else if(h > 3){m = m -180;h = 3}
else if(h > 2){m = m -120;h = 2}
else if(h > 1){m = m -60;h = 1}
else if(h < 1){m = m ;h = 0}
var m = (m+"").split(".")[0];
var s = s - ( (h * 60 *60)+ (m *60));
console.log("Bot awake in : "+h + " H " +m+ " M "+s.toFixed(0)+ " S " );



If bot is awake we get total resteemed posts var totalAwaitPosts = awaitingPosts.length; and we count how much vote percent we will give to every post votingPower = Math.round(((Bconfig[3] / totalAwaitPosts) *100) * 1) / 1 ; and exporting awaitingPosts array to array **PostsToVote ** to make new resteemed posts await to next vote .

And we vote all pending postes one by one in for function

for(var i=0; i<PostsToVote.length; i++){
var u_a_p = PostsToVote[i].split("//"); // username and permlink
console.log("Voting for "+u_a_p[0]+" permlink : "+u_a_p[1]);
vote(u_a_p[0],u_a_p[1]);
......................



I've added system-sleep module var sleep = require('system-sleep'); to make time betwin every vote because steemit allow only 3s betwin two votes , sleep(6000);.


When bot finish voting all postes we call it to sleep botSleep(Bconfig[0],Bconfig[1]);


Cheers!


Task link : https://utopian.io/utopian-io/@gktown/resteemit-com-roadmap-seeking-developers
Project link : https://github.com/gktown/resteemit
Pull request link : https://github.com/gktown/resteemit/pull/1



Posted on Utopian.io - Rewarding Open Source Contributors

Leave Development of Resteemit to:

Written by

Addicted to Dev.

Read more #utopian-io posts


Best Posts From SweeVer

We have not curated any of sweever's posts yet. But you can encourage our curation team to review posts by visiting them regularly and by referring other readers. Because we give priority to frequently read content.

More Posts From SweeVer