"Resteemit.com" | Fix bugs & run service for better process

in utopian-io •  7 years ago  (edited)

contribution.png



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.



Changement summary :

  • Add log for voted posts & resteemed posts.
  • Add new vote function & renew old one.
  • Add interval checker
  • Add comment functionality
  • Fix duplicated comments


- Add log for voted posts & resteemed posts.

I added log to the console for both functions :

  • vote
    if(err){console.log(err)};
  • resteem
    if(err){console.log(err)};if(result){console.log("Resteem Succes for "+user)}


    After i've add a new vote function 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 .

- Add interval checker :

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)
{
................

- Add comment functionality

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);

- Fix duplicated comments

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);


Note : all changement are made in one file server.js



Project link : https://github.com/gktown/resteemit
Pull requests links :
PR #3
PR #4
PR #8

Cheers!




Posted on Utopian.io - Rewarding Open Source Contributors

Authors get paid when people like you upvote their post.
If you enjoyed what you read here, create your account today and start earning FREE STEEM!
Sort Order:  

Great work @sweeverdev -- Resteemit.com is looking better and better all the time thanks to you.

thank you very much , i'm looking to make it more better in the future :)

  ·  7 years ago 

Thank you for the contribution. It has been approved.

You can contact us on Discord.
[utopian-moderator]

thank you

Hey @sweeverdev 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