This is my secend contribution to the development of resteemit.com Project by @gktown
Resteemit.com is a Public Curation Project
Resteemit take any steemit article and resteem it on @resteemable, from where the post is upvoted by the resteemable trail.
I added log to the console for both functions :
if(err){console.log(err)};if(err){console.log(err)};if(result){console.log("Resteem Succes for "+user)}voteAwaitingpostes , because in the last one , the log show only the first post upvoted in for methode .var voteAwaitingpostes = function()
{
var totalAwaitPosts = awaitingPosts.length;
if( totalAwaitPosts > 1)
{
console.log("Bot is ready !!");
......................
And for the old fuction resteemable i let only time logger & line to push reblogged postes in the Array .
for a better process , this Intervel will check if bot (awake or sleep) with condition if(SleepAt < CurrentDate) every 10s ,
if so bot sleep again and voteAwaitingpostes function called
setInterval(function() {
var CurrentDate = Date.now();
if(SleepAt < CurrentDate)
{
................
I've add doComment function for commenting to voted postes , also to notify to users that the service is working .
var doComment = function(Vuser,Permlink){
var comment = "---------------------.";
var commentPermlink = steem.formatter.commentPermlink(voter, Permlink);
.........................
Next i implement it in voteAwaitingpostesfunction after vote function , and i set a timout to 20s betwin every (comment & vote) , because steemit allow only to comment 1 time every 20s.
doComment(u_a_p[0],u_a_p[1]);
sleep(20000);
I've added Duplicated function that check if submitted posts already exist or not...
var Duplicated = function(Suser,Stitle)
{
for(var i=0; i<awaitingPosts.length; i++){
........................
then i implement it in resteemable function , the idea is befor adding post to awaiting list we call duplicated function that return true or false , so we check if true we add post to the list , if not we log to console .
if(!Duplicated(Suser,Stitle))awaitingPosts.push(Suser+"//"+Stitle);
else console.log("Duplicated Poste : " + Suser+" - " + Stitle);
server.js
Project link : https://github.com/gktown/resteemit
Pull requests links :
PR #3
PR #4
PR #8