Skip to content

Instantly share code, notes, and snippets.

@code-with-sam
Created February 16, 2018 20:57
Show Gist options
  • Save code-with-sam/262b549a9219cae07be612c527c35440 to your computer and use it in GitHub Desktop.
Save code-with-sam/262b549a9219cae07be612c527c35440 to your computer and use it in GitHub Desktop.
<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