Skip to main content
Revertido a la revisión 3 - codigo completo
Origen Enlace
var u = 0;
const friendsfriendsz = [
      'baller',
      'enginewitty''juan',
      'curacion.spanish ''luis',
      'inber','carlos'
      'fmbs25'
];                                                                                                  // Your Friend list.
var verifyVote = false;

var myInt = setInterval(function () {

    if (u < friendsfriendsz.length) {
        //console.log(friendsz[u++]);
        wkd.api.getDiscussionsByBlog({tag: friends[u++]friendsz[u++], limit: 1}, (err, res) => { 
            var author = res[0].author;
            var permlink = res[0].permlink;
            console.log(author);
            console.log(permlink);
        
        wkd.api.getActiveVotes(author, permlink, (err, res) => {

        for (var i = 0; i < res.length; i++) {
            var post = res[i].voter;
            if (res[i].voter == voter) {
                verifyVote = true;
            }
        }
        if (verifyVotepost == voter) {
            console.log("[Weku Buster Bot] says:".yellow, "The Post:", permlink, "of the user", author, "has already been voted.");
        }else{
            wkd.broadcast.vote(wif, voter, author, permlink, weight, (err, res) => { 
                console.log("[Weku Buster Bot] says: ".yellow + "Your Friend " + author + " Got " + weight/100 + "% Upvote For his last post.");
            });
            wkd.broadcast.comment(wifPosting, author, permlink, voter, comment_permlink, title, body, jsonMetadata, (err, res) => {
                console.log("[Weku Buster Bot] says: ".yellow + "We have announced to your friend " + author + " that you have voted his last post a weight: " + weight/100 + " %.");
        });
        }
        }
    });
    });
}

}, 15000);
var u = 0;
const friends = [
      'baller',
      'enginewitty',
      'curacion.spanish ',
      'inber',
      'fmbs25'
];                                                                                                  // Your Friend list.
var verifyVote = false;

var myInt = setInterval(function () {

    if (u < friends.length) {
        //console.log(friendsz[u++]);
        wkd.api.getDiscussionsByBlog({tag: friends[u++], limit: 1}, (err, res) => { 
            var author = res[0].author;
            var permlink = res[0].permlink;
            console.log(author);
            console.log(permlink);
        
        wkd.api.getActiveVotes(author, permlink, (err, res) => {

        for (var i = 0; i < res.length; i++) {
            var post = res[i].voter;
            if (res[i].voter == voter) {
                verifyVote = true;
            }
        }
        if (verifyVote) {
            console.log("[Weku Buster Bot] says:".yellow, "The Post:", permlink, "of the user", author, "has already been voted.");
        }else{
            wkd.broadcast.vote(wif, voter, author, permlink, weight, (err, res) => { 
                console.log("[Weku Buster Bot] says: ".yellow + "Your Friend " + author + " Got " + weight/100 + "% Upvote For his last post.");
            });
            wkd.broadcast.comment(wifPosting, author, permlink, voter, comment_permlink, title, body, jsonMetadata, (err, res) => {
                console.log("[Weku Buster Bot] says: ".yellow + "We have announced to your friend " + author + " that you have voted his last post a weight: " + weight/100 + " %.");
        });
        }
    });
    });
}

}, 15000);
var u = 0;
const friendsz = [
      'juan',
      'luis',
      'carlos'
    ];  
var myInt = setInterval(function () {

    if (u < friendsz.length) {
        //console.log(friendsz[u++]);
        wkd.api.getDiscussionsByBlog({tag: friendsz[u++], limit: 1}, (err, res) => { 
            var author = res[0].author;
            var permlink = res[0].permlink;
            console.log(author);
            console.log(permlink);
        
        wkd.api.getActiveVotes(author, permlink, (err, res) => {

        for (var i = 0; i < res.length; i++) {
            var post = res[i].voter;
            
        if (post == voter) {
            console.log("[Weku Buster Bot] says:".yellow, "The Post:", permlink, "of the user", author, "has already been voted.");
        }else{
            wkd.broadcast.vote(wif, voter, author, permlink, weight, (err, res) => { 
                console.log("[Weku Buster Bot] says: ".yellow + "Your Friend " + author + " Got " + weight/100 + "% Upvote For his last post.");
            });
            wkd.broadcast.comment(wifPosting, author, permlink, voter, comment_permlink, title, body, jsonMetadata, (err, res) => {
                console.log("[Weku Buster Bot] says: ".yellow + "We have announced to your friend " + author + " that you have voted his last post a weight: " + weight/100 + " %.");
        });
        }
        }
    });
    });
}

}, 15000);
nuevo codigo
Origen Enlace
var u = 0;
const friendszfriends = [
      'juan''baller',
      'luis''enginewitty',
      'carlos''curacion.spanish ',
      'inber',
      'fmbs25'
];                                                                                                  // Your Friend list.
var verifyVote = false;

var myInt = setInterval(function () {

    if (u < friendszfriends.length) {
        //console.log(friendsz[u++]);
        wkd.api.getDiscussionsByBlog({tag: friendsz[u++]friends[u++], limit: 1}, (err, res) => { 
            var author = res[0].author;
            var permlink = res[0].permlink;
            console.log(author);
            console.log(permlink);
        
        wkd.api.getActiveVotes(author, permlink, (err, res) => {

        for (var i = 0; i < res.length; i++) {
            var post = res[i].voter;
            if (res[i].voter == voter) {
        if (post == voter     verifyVote = true;
            }
        }
        if (verifyVote) {
            console.log("[Weku Buster Bot] says:".yellow, "The Post:", permlink, "of the user", author, "has already been voted.");
        }else{
            wkd.broadcast.vote(wif, voter, author, permlink, weight, (err, res) => { 
                console.log("[Weku Buster Bot] says: ".yellow + "Your Friend " + author + " Got " + weight/100 + "% Upvote For his last post.");
            });
            wkd.broadcast.comment(wifPosting, author, permlink, voter, comment_permlink, title, body, jsonMetadata, (err, res) => {
                console.log("[Weku Buster Bot] says: ".yellow + "We have announced to your friend " + author + " that you have voted his last post a weight: " + weight/100 + " %.");
        });
        }
        }
    });
    });
}

}, 15000);
var u = 0;
const friendsz = [
      'juan',
      'luis',
      'carlos'
    ];  
var myInt = setInterval(function () {

    if (u < friendsz.length) {
        //console.log(friendsz[u++]);
        wkd.api.getDiscussionsByBlog({tag: friendsz[u++], limit: 1}, (err, res) => { 
            var author = res[0].author;
            var permlink = res[0].permlink;
            console.log(author);
            console.log(permlink);
        
        wkd.api.getActiveVotes(author, permlink, (err, res) => {

        for (var i = 0; i < res.length; i++) {
            var post = res[i].voter;
            
        if (post == voter) {
            console.log("[Weku Buster Bot] says:".yellow, "The Post:", permlink, "of the user", author, "has already been voted.");
        }else{
            wkd.broadcast.vote(wif, voter, author, permlink, weight, (err, res) => { 
                console.log("[Weku Buster Bot] says: ".yellow + "Your Friend " + author + " Got " + weight/100 + "% Upvote For his last post.");
            });
            wkd.broadcast.comment(wifPosting, author, permlink, voter, comment_permlink, title, body, jsonMetadata, (err, res) => {
                console.log("[Weku Buster Bot] says: ".yellow + "We have announced to your friend " + author + " that you have voted his last post a weight: " + weight/100 + " %.");
        });
        }
        }
    });
    });
}

}, 15000);
var u = 0;
const friends = [
      'baller',
      'enginewitty',
      'curacion.spanish ',
      'inber',
      'fmbs25'
];                                                                                                  // Your Friend list.
var verifyVote = false;

var myInt = setInterval(function () {

    if (u < friends.length) {
        //console.log(friendsz[u++]);
        wkd.api.getDiscussionsByBlog({tag: friends[u++], limit: 1}, (err, res) => { 
            var author = res[0].author;
            var permlink = res[0].permlink;
            console.log(author);
            console.log(permlink);
        
        wkd.api.getActiveVotes(author, permlink, (err, res) => {

        for (var i = 0; i < res.length; i++) {
            var post = res[i].voter;
            if (res[i].voter == voter) {
                verifyVote = true;
            }
        }
        if (verifyVote) {
            console.log("[Weku Buster Bot] says:".yellow, "The Post:", permlink, "of the user", author, "has already been voted.");
        }else{
            wkd.broadcast.vote(wif, voter, author, permlink, weight, (err, res) => { 
                console.log("[Weku Buster Bot] says: ".yellow + "Your Friend " + author + " Got " + weight/100 + "% Upvote For his last post.");
            });
            wkd.broadcast.comment(wifPosting, author, permlink, voter, comment_permlink, title, body, jsonMetadata, (err, res) => {
                console.log("[Weku Buster Bot] says: ".yellow + "We have announced to your friend " + author + " that you have voted his last post a weight: " + weight/100 + " %.");
        });
        }
    });
    });
}

}, 15000);
codigo real.
Origen Enlace

Hola estoy tratando de realizar esta condicional dentro de este for el error que surge eshaciendo un programa que arealiza votes en la horacadena de saltar a el else me arroja:bloques de steemjs.

Mi codigo

novar sonu iguales= 0;
sonconst similaresfriendsz = [
no son iguales    'juan',
no son iguales    'luis',

Lo que necesito es que solo me diga si "son similares" si son similares o "no son iguales" si no son iguales, no quiero que se ponga a iterar el else.

Mi codigo:

      'carlos'
    ];  
var listamyInt = ['andres'setInterval(function () {

    if (u < friendsz.length) {
        //console.log(friendsz[u++]);
        wkd.api.getDiscussionsByBlog({tag: friendsz[u++], 'miguel'limit: 1}, 'antonio'(err, 'luisa'];res) => { 
            var author = res[0].author;
            var permlink = res[0].permlink;
            console.log(author);
            console.log(permlink);
        
        wkd.api.getActiveVotes(author, permlink, (err, res) => {

        for (var i = 0; i < listares.length; i++) {
   var usuario = 'miguel';
      var post = lista[i];res[i].voter;
            
        if (post == usuariovoter) {
            console.log('son"[Weku similares'Buster Bot] says:".yellow, "The Post:", permlink, "of the user", author, "has already been voted.");
 
        }else{
            wkd.broadcast.vote(wif, voter, author, permlink, weight, (err, res) => { 
                console.log('no"[Weku sonBuster iguales'Bot] says: ".yellow + "Your Friend " + author + " Got " + weight/100 + "% Upvote For his last post.");
            });
            wkd.broadcast.comment(wifPosting, author, permlink, voter, comment_permlink, title, body, jsonMetadata, (err, res) => {
                console.log("[Weku Buster Bot] says: ".yellow + "We have announced to your friend " + author + " that you have voted his last post a weight: " + weight/100 + " %.");
        });
        }
        }
    });
    });
}

}, 15000);

EL problema que surge es que al realizar la comparación de post y user hace que que todo el if se ejecute y me causa errores.

post == voter verifica que el usuario ya ha votado si no ha votado, tendría que saltar a else y ejecutar las funciones. pero en este caso ejecuta las 2 cosas a la ves y me provoca errores. ¿Entonces como puedo hacer bien esa condicional?

Hola estoy tratando de realizar esta condicional dentro de este for el error que surge es que a la hora de saltar a el else me arroja:

no son iguales
son similares
no son iguales
no son iguales

Lo que necesito es que solo me diga si "son similares" si son similares o "no son iguales" si no son iguales, no quiero que se ponga a iterar el else.

Mi codigo:

var lista = ['andres', 'miguel', 'antonio', 'luisa'];

for (var i = 0; i < lista.length; i++) {
   var usuario = 'miguel';
   var post = lista[i];
   
   if (post == usuario) {
      console.log('son similares');
 
   }else{
      console.log('no son iguales');      
   }
}

Hola estoy haciendo un programa que realiza votes en la cadena de bloques de steemjs.

Mi codigo

var u = 0;
const friendsz = [
      'juan',
      'luis',
      'carlos'
    ];  
var myInt = setInterval(function () {

    if (u < friendsz.length) {
        //console.log(friendsz[u++]);
        wkd.api.getDiscussionsByBlog({tag: friendsz[u++], limit: 1}, (err, res) => { 
            var author = res[0].author;
            var permlink = res[0].permlink;
            console.log(author);
            console.log(permlink);
        
        wkd.api.getActiveVotes(author, permlink, (err, res) => {

        for (var i = 0; i < res.length; i++) {
            var post = res[i].voter;
            
        if (post == voter) {
            console.log("[Weku Buster Bot] says:".yellow, "The Post:", permlink, "of the user", author, "has already been voted.");
        }else{
            wkd.broadcast.vote(wif, voter, author, permlink, weight, (err, res) => { 
                console.log("[Weku Buster Bot] says: ".yellow + "Your Friend " + author + " Got " + weight/100 + "% Upvote For his last post.");
            });
            wkd.broadcast.comment(wifPosting, author, permlink, voter, comment_permlink, title, body, jsonMetadata, (err, res) => {
                console.log("[Weku Buster Bot] says: ".yellow + "We have announced to your friend " + author + " that you have voted his last post a weight: " + weight/100 + " %.");
        });
        }
        }
    });
    });
}

}, 15000);

EL problema que surge es que al realizar la comparación de post y user hace que que todo el if se ejecute y me causa errores.

post == voter verifica que el usuario ya ha votado si no ha votado, tendría que saltar a else y ejecutar las funciones. pero en este caso ejecuta las 2 cosas a la ves y me provoca errores. ¿Entonces como puedo hacer bien esa condicional?

se añadió 1 carácter en el cuerpo; etiquetas editadas
Origen Enlace
Loading
Origen Enlace
Loading