Created
February 16, 2018 20:57
-
-
Save code-with-sam/262b549a9219cae07be612c527c35440 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<html> | |
<head> | |
<title>Bot's in Steem-js</title> | |
<script src="https://cdn.steemjs.com/lib/latest/steem.min.js"></script> | |
<script> | |
const ACCOUNT_NAME = '' | |
const ACCOUNT_KEY = '' | |
const TARGET_ACCOUNT = 'sambillingham' | |
steem.api.streamTransactions('head', function(err, result) { | |
let txType = result.operations[0][0] | |
let txData = result.operations[0][1] | |
if(txType == 'vote' && txData.voter == TARGET_ACCOUNT) { | |
console.log(TARGET_ACCOUNT, ': has just voted') | |
console.log(txData.author, txData.permlink, txData.weight) | |
sendVote(txData.author, txData.permlink, txData.weight) | |
} | |
}); | |
function sendVote(author, permlink, weight){ | |
steem.broadcast.vote(ACCOUNT_KEY, ACCOUNT_NAME, author, permlink, weight, function(err, result) { | |
console.log(err, result) | |
console.log(`WE have just copied ${TARGET_ACCOUNT} and also upvoted ${author}`) | |
}); | |
} | |
</script> | |
</head> | |
<body></body> | |
</html> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment